Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound 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 
00025 class XMLReader {
00026 private:
00027   enum {
00028     TAG_OPEN_TYPE,
00029     TAG_CLOSE_TYPE,
00030     TAG_OPEN_CLOSE_TYPE
00031   };
00032 
00033   int _tryFindChar( char ch, const char* buffer, int start, int finish );
00034   int _findChar( char ch, const char* buffer, int start, int finish );
00035   int _tryFindBeginTag( const char* buffer, int start, int finish );
00036   int _findBeginTag( const char* buffer, int start, int finish );
00037   int _findEndTag( const char* buffer, int start, int finish );
00038   int _tryFindText( const char* buffer, int start, int finish );
00039   int _findText( const char* buffer, int start, int finish );
00040   int _findNotName( const char* buffer, int start, int finish );
00041   int _findSpace( const char* buffer, int start, int finish );
00042   int _readTag( const char* buffer, int bufferStart, int bufferEnd, std::string* tagName, std::map<std::string, std::string>* attributes, int* tagType );
00043   int _findClosingTag( const char* buffer, int start, int end, std::string& openingTagName, bool* tagsBetween );
00044   void _read( XMLNode** parent, const char* buffer, int start, int end );
00045 
00046 public:
00047   XMLNode* read( const char* buffer, size_t length );
00048   XMLNode* read( const std::string& str );
00049 };
00050 
00051 #endif // _MONITOR_XMLREADER_H

Generated on Wed Nov 3 12:59:08 2004 for Lemur Toolkit by doxygen1.2.18