00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026 #ifndef _CERTI_XML_PARSER_HH
00027 #define _CERTI_XML_PARSER_HH
00028
00029
00030 #include "RootObject.hh"
00031 #include "ObjectClass.hh"
00032 #include "Interaction.hh"
00033
00034
00035 #ifdef HAVE_XML
00036 #include <libxml/xmlmemory.h>
00037 #include <libxml/parser.h>
00038 #endif
00039
00040
00041 #include <string>
00042
00043 namespace certi {
00044
00048 class CERTI_EXPORT XmlParser
00049 {
00050 public:
00051
00056 XmlParser(RootObject* root);
00057
00063 RootObject* parse(std::string pathToXmlFile);
00064
00072 static bool exists(void);
00073
00074 #if HAVE_XML
00075
00079 class CleanXmlGetProp {
00080 public:
00087 CleanXmlGetProp(_xmlNode* node, const xmlChar* propName) {
00088 prop = xmlGetProp(node,propName);
00089 }
00093 operator const char*() {
00094 return reinterpret_cast<const char*>(prop);
00095 }
00096
00097 ~CleanXmlGetProp(){
00098 xmlFree(prop);
00099 }
00100 private:
00101 xmlChar* prop;
00102 };
00103 #endif
00104 private:
00109 void parseClass(ObjectClass *parent);
00110
00115 void parseInteraction(Interaction *parent);
00116
00120 void parseRoutingSpace(void);
00121
00122 int freeObjectClassHandle ;
00123 int freeInteractionClassHandle ;
00124 int freeAttributeHandle ;
00125 int freeParameterHandle ;
00126 int freeSpaceHandle ;
00127
00128 std::string filename ;
00129 RootObject* root ;
00130
00131 #ifdef HAVE_XML
00132 xmlDocPtr doc;
00133 xmlNodePtr cur;
00134 #endif
00135 };
00136
00137 }
00138
00139 #endif // _CERTI_XML_PARSER_HH
00140
00141