00001 00002 #ifndef SXMLP_H 00003 #define SXMLP_H 00004 00005 #include <queue> 00006 00007 typedef std::queue<char *> stringQ; 00008 00009 00010 class SXMLP { 00011 public: 00012 SXMLP(); 00013 char * nextName(void); 00014 char * nextValue(void); 00015 bool loadFile(char *s); 00016 char * getRootName(void); 00017 private: 00018 char * rootTagName; 00019 int num; 00020 stringQ elements; 00021 stringQ values; 00022 00023 void setRootName(char *s); 00024 void addElement(char *s, char *t); 00025 char * trimSpaces(char *); 00026 int isElement(char *); 00027 char * elementName(char *); 00028 char * elementValue(char *); 00029 00030 }; 00031 /* 00032 // default constructor 00033 SXMLP::SXMLP(); 00034 00035 //attempts to load a valid XML file into the parser 00036 bool SXMLP::loadFile(char *filename); 00037 00038 //Returns the name of the next element 00039 char * SXMLP::nextName(); 00040 //returns the value of the next element's tag 00041 char * SXMLP::nextValue(); 00042 00043 00044 //-----------private functions 00045 00046 //set the name of the root tag 00047 void SXMLP::setName(char * s); 00048 //add a tag name and value to thte parser 00049 void SXMLP::addElement(char *s, char *t); 00050 //trims leading tabs and spaces 00051 char * SXMLP::trimSpaces(char *s); 00052 //what kind of element is this line? 00053 int SXMLP::isElement(char *s); 00054 //extract element tag name from line 00055 char * SXMLP::elementName(char *s); 00056 //extract element's value from line 00057 char * SXMLP::elementValue(char *s); 00058 */ 00059 #endif 00060