Main Page | Namespace List | Class Hierarchy | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

XMLReader.hpp

Go to the documentation of this file.
00001 /*==========================================================================
00002  * Copyright (c) 2004 University of Massachusetts.  All Rights Reserved.
00003  *
00004  * Use of the Lemur Toolkit for Language Modeling and Information Retrieval
00005  * is subject to the terms of the software license set forth in the LICENSE
00006  * file included with this software, and also available at
00007  * http://www.lemurproject.org/license.html
00008  *
00009  *==========================================================================
00010  */
00011 
00012 
00013 //
00014 // XMLReader
00015 //
00016 // 8 October 2003 - tds
00017 //
00018 
00019 #ifndef _MONITOR_XMLREADER_H
00020 #define _MONITOR_XMLREADER_H
00021 
00022 #include <string>
00023 #include "indri/XMLNode.hpp"
00024 namespace indri
00025 {
00026   namespace xml
00027   {
00028     
00029     class XMLReader {
00030     private:
00031       enum {
00032         TAG_OPEN_TYPE,
00033         TAG_CLOSE_TYPE,
00034         TAG_OPEN_CLOSE_TYPE,
00035         TAG_CDATA_TYPE
00036       };
00037 
00038       int _tryFindChar( char ch, const char* buffer, int start, int finish );
00039       int _findChar( char ch, const char* buffer, int start, int finish );
00040       int _tryFindBeginTag( const char* buffer, int start, int finish );
00041       int _findBeginTag( const char* buffer, int start, int finish );
00042       int _findEndTag( const char* buffer, int start, int finish );
00043       int _tryFindText( const char* buffer, int start, int finish );
00044       int _findText( const char* buffer, int start, int finish );
00045       int _findNotName( const char* buffer, int start, int finish );
00046       int _findSpace( const char* buffer, int start, int finish );
00047       int _readTag( const char* buffer, int bufferStart, int bufferEnd, std::string* tagName, std::map<std::string, std::string>* attributes, int* tagType );
00048       int _findClosingTag( const char* buffer, int start, int end, std::string& openingTagName, bool* tagsBetween );
00049       void _read( XMLNode** parent, const char* buffer, int start, int end );
00050 
00051     public:
00052       XMLNode* read( const char* buffer, size_t length );
00053       XMLNode* read( const std::string& str );
00054     };
00055   }
00056 }
00057 
00058 #endif // _MONITOR_XMLREADER_H

Generated on Tue Jun 15 11:02:56 2010 for Lemur by doxygen 1.3.4