00001 00005 /* 00006 Copyright (C) 2004 grymse@alhem.net 00007 00008 This program is free software; you can redistribute it and/or 00009 modify it under the terms of the GNU General Public License 00010 as published by the Free Software Foundation; either version 2 00011 of the License, or (at your option) any later version. 00012 00013 This program 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 00016 GNU General Public License for more details. 00017 00018 You should have received a copy of the GNU General Public License 00019 along with this program; if not, write to the Free Software 00020 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 00021 */ 00022 #ifndef _BASEXMLFILE_H 00023 #define _BASEXMLFILE_H 00024 00025 #include <string> 00026 #include <libxml/xmlmemory.h> 00027 #include <libxml/parser.h> 00028 00029 00030 class BaseXMLFile 00031 { 00032 public: 00033 BaseXMLFile(const std::string& filename,const std::string& verify_ns = "",const std::string& verify_root = ""); 00034 ~BaseXMLFile(); 00035 00036 xmlDocPtr GetDocument() { return m_doc; } 00037 xmlNodePtr GetRootElement(); 00038 std::string GetProperty(const std::string& ); 00039 xmlNodePtr GetChildrenNode(); 00040 xmlNodePtr GetNextNode(); 00041 const std::string& GetNodeName(); 00042 void SetCurrent(xmlNodePtr p) { m_current = p; } 00043 xmlNsPtr GetNodeNs(); 00044 const std::string& GetNodeNsPrefix(); 00045 const std::string& GetNodeNsHref(); 00046 00047 xmlNodePtr GetFirstElement(const std::string& ); 00048 xmlNodePtr GetFirstElement(xmlNodePtr,const std::string& ); 00049 xmlNodePtr GetNextElement(xmlNodePtr,const std::string& ); 00050 00051 private: 00052 xmlDocPtr m_doc; 00053 xmlNodePtr m_current; 00054 std::string m_current_name; 00055 std::string m_ns_prefix; 00056 std::string m_ns_href; 00057 }; 00058 00059 00060 00061 00062 #endif // _BASEXMLFILE_H