00001
00002
00003
00004
00005
00006
00007
00009
00010 #ifdef wxXMLDOM_XERCES
00011
00012 #ifndef __wx_xmldom_h__
00013 #define __wx_xmldom_h__
00014
00015 #include "wx/defs.h"
00016
00017 #include <xercesc/dom/DOM.hpp>
00018
00019 #include <vector>
00020
00021 using namespace XERCES_CPP_NAMESPACE;
00022
00023 namespace wx
00024 {
00025
00026 class XmlNode;
00027
00032 class XmlAttributes
00033 {
00034
00035 friend class XmlNode;
00036
00037
00038 private:
00045 XmlAttributes(DOMElement * elmParent);
00046
00051 XmlAttributes() {};
00052
00053
00054 public:
00063 wxString operator[](const wxString& sName) const;
00064
00065
00066
00067 private:
00073 void SetNode(DOMElement * elmParent);
00074
00075
00076 private:
00077 DOMElement * m_elmParent;
00078 };
00079
00080 class XmlDocument;
00081 class XmlNodeArray;
00082
00083 class XmlNode
00084 {
00085
00086 friend class XmlDocument;
00087
00088
00089 public:
00090 XmlNode(const XmlNode& nodOther);
00091 ~XmlNode();
00092 private:
00093 XmlNode() {};
00094 XmlNode(DOMElement * elm);
00095
00096
00097
00098
00099 public:
00106 XmlNodeArray GetNodes(const wxString& sXPathQuery);
00107 XmlNode GetNode(const wxString& sXPathQuery);
00108 wxString ToString();
00109 wxString GetText();
00110
00111 private:
00112 void SetNode(DOMElement * elm);
00113
00114
00115 public:
00116 XmlAttributes Attributes;
00117 private:
00118 DOMElement * m_elm;
00119 };
00120
00121 class XmlDocument : public XmlNode
00122 {
00123
00124
00125 public:
00126 XmlDocument();
00127 ~XmlDocument();
00128
00129
00130
00131 public:
00138 void Load(const wxString& sPathName);
00139 void Save();
00140 void SaveAs(const wxString& sPathName);
00141
00142
00143 private:
00144 DOMDocument * doc;
00145 wxString m_sPathName;
00146 };
00147
00148 class XmlNodeArray : private std::vector<XmlNode>
00149 {
00150
00151 friend class XmlNode;
00152
00153
00154 public:
00155
00156
00157 public:
00158 const XmlNode& operator[](int i);
00159
00160
00161 public:
00162 int GetLength();
00163
00164 private:
00165 void Push(const XmlNode& nod);
00166
00167
00168 };
00169
00170 }
00171
00172 #endif // ndef __wx_xmldom_h__
00173
00174 #endif
00175