00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #ifndef XML_H
00023 #define XML_H
00024
00025 #include <libxml/tree.h>
00026
00027 #include <string>
00028
00032 namespace XML
00033 {
00038 class Document
00039 {
00040 public:
00045 Document(const std::string &filename);
00046
00054 Document(const char *data, int size);
00055
00059 ~Document();
00060
00065 xmlNodePtr rootNode();
00066
00067 private:
00068 xmlDocPtr mDoc;
00069 };
00070
00074 int getProperty(xmlNodePtr node, const char *name, int def);
00075
00079 double getFloatProperty(xmlNodePtr node, const char *name, double def);
00080
00084 std::string getProperty(xmlNodePtr node, const char *name,
00085 const std::string &def);
00086
00090 xmlNodePtr findFirstChildByName(xmlNodePtr parent, const char *name);
00091 }
00092
00093 #define for_each_xml_child_node(var, parent) \
00094 for (xmlNodePtr var = parent->xmlChildrenNode; var; var = var->next)
00095
00096 #endif // XML_H