nxmldocument.h

Go to the documentation of this file.
00001 // LICENSE: (Please see the file COPYING for details)
00002 //
00003 // NUS - Nemesis Utilities System: A C++ application development framework 
00004 // Copyright (C) 2006, 2008 Otavio Rodolfo Piske
00005 //
00006 //  This file is part of NUS
00007 //
00008 //  This library is free software; you can redistribute it and/or
00009 //  modify it under the terms of the GNU Lesser General Public
00010 //  License as published by the Free Software Foundation version 2.1
00011 //  of the License.
00012 //
00013 //  This library is distributed in the hope that it will be useful,
00014 //  but WITHOUT ANY WARRANTY; without even the implied warranty of
00015 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00016 //  Lesser General Public License for more details.
00017 //
00018 //  You should have received a copy of the GNU Lesser General Public
00019 //  License along with this library; if not, write to the Free Software
00020 //  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
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             // This constructor is used by NXmlReader class which needs to
00150             // instantiate a NXmlDocument object without a particular 
00151             // rootElement thus making itself the initialization of the 
00152             // object
00153             NXmlDocument(void);
00154             
00155             // Methods used by NXmlReader to initialize this class
00156             void setXmlDoc(xmlDocPtr doc);
00157             
00158             
00159             // This method is used by friend classes to obtain the
00160             // xmlDocPtr structure that this class abstracts
00161             xmlDocPtr getXmlDoc(void);
00162             
00163             // This methods are not implemented
00164             NXmlDocument(const NXmlDocument &other);
00165             NXmlDocument &operator=(const NXmlDocument &other);
00166             
00167 };
00168 
00169 #endif // NXMLDOCUMENT_H

Generated on Wed Mar 5 23:10:36 2008 for NemesisUtilitiesSystem by  doxygen 1.5.4