00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #ifndef NXMLDOCUMENT_H
00023 #define NXMLDOCUMENT_H
00024
00032 #include <libxml/tree.h>
00033 #include <libxml/parser.h>
00034 #include <libxml/xpath.h>
00035 #include <libxml/xpathInternals.h>
00036
00037 #include "ndefs.h"
00038 #include "nobject.h"
00039 #include "nexception.h"
00040 #include "nxmlnode.h"
00041 #include "ndebug.h"
00042 #include "nxmlerror.h"
00043
00044
00048 class DllDeclSpec NXmlDocument: public NObject {
00049 friend class NXmlReader;
00050 friend class NXmlWriter;
00051
00052 public:
00057 NXmlDocument(const NString &rootElement);
00058
00063 ~NXmlDocument(void);
00064
00069 void setRootNode(const NXmlNode &root);
00074 NXmlNode getRootNode(void);
00079 const NXmlNode constGetRootNode(void) const;
00080
00086 NXmlNode findNode(const NString &name);
00087
00093 const NXmlNode constFindNode(const NString &name) const;
00094
00100 NXmlNode next(void);
00101
00107 const NXmlNode constNext(void) const;
00108
00114 NXmlNode previous(void);
00115
00121 const NXmlNode constPrevious(void) const;
00122
00128 void setEncoding(const NString &encoding);
00129
00133 NString getEncoding(void) const;
00134
00135 private:
00136 xmlDocPtr m_doc;
00137 NXmlNode m_root;
00138
00139
00140 mutable xmlXPathContextPtr m_xpath_ctxt;
00141 mutable xmlXPathObjectPtr m_xpath_obj;
00142 mutable nint32 m_pos;
00143
00144 void init(void);
00145
00146 void freeSearchResources(void) const;
00147 void createSearchResources(const NString &expr) const;
00148
00149
00150
00151
00152
00153 NXmlDocument(void);
00154
00155
00156 void setXmlDoc(xmlDocPtr doc);
00157
00158
00159
00160
00161 xmlDocPtr getXmlDoc(void);
00162
00163
00164 NXmlDocument(const NXmlDocument &other);
00165 NXmlDocument &operator=(const NXmlDocument &other);
00166
00167 };
00168
00169 #endif // NXMLDOCUMENT_H