Main Page   Namespace List   Class Hierarchy   Compound List   File List   Compound Members  

XMLReader.h

00001 /*
00002    Copyright (C) 2003 the Strongroom project
00003 
00004    This library is free software; you can redistribute it and/or
00005    modify it under the terms of the GNU Lesser General Public
00006    License as published by the Free Software Foundation; either
00007    version 2.1 of the License, or (at your option) any later version.
00008 
00009    @author Ewald Snel
00010 */
00011 
00012 #ifndef __XMLREADER_H
00013 #define __XMLREADER_H
00014 
00015 #ifdef HAVE_CONFIG_H
00016 #include <config.h>
00017 #endif
00018 
00019 #include <stdint.h>
00020 #include <string>
00021 
00022 
00023 using namespace std;
00024 
00028 class ParseException
00029 {
00030 public:
00031     ParseException( const char *msg );
00032 
00033     const char *getMessage();
00034 
00035 private:
00036     const char *message;
00037 };
00038 
00046 class XMLReader
00047 {
00048 public:
00049     XMLReader();
00050     ~XMLReader();
00051 
00052     bool hasChildren() throw (ParseException);
00053     bool hasContent() throw (ParseException);
00054     const char *openChild() throw (ParseException);
00055     const char *openChild( const char *name ) throw (ParseException);
00056     const char *getContent() throw (ParseException);
00057     const char **getAttributes() throw (ParseException);
00058     const char *getAttribute( const char *name ) throw (ParseException);
00059     bool getAttributeBool( const char *name ) throw (ParseException);
00060     int getAttributeInt( const char *name ) throw (ParseException);
00061     int64_t getAttributeLong( const char *name ) throw (ParseException);
00062     const char *getAttributeNS( const char *prefix ) throw (ParseException);
00063     void closeNode( bool ignoreChildren = false ) throw (ParseException);
00064 
00065     void open( const string &str ) throw (ParseException);
00066 
00067 private:
00068     void parseAttributes() throw (ParseException);
00069     void parseEndTag() throw (ParseException);
00070     const char *parseName() throw (ParseException);
00071     const char *readEscaped( char endChar ) throw (ParseException);
00072     bool skipWhiteSpace();
00073 
00074     char *xml, *data;
00075     const char **stack, *content, **attributes;
00076 };
00077 
00078 #endif

Generated on Wed Feb 18 13:45:56 2004 for strongroom by doxygen1.2.18