00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #ifndef XMLDOC_H_
00025 #define XMLDOC_H_
00026 #include <boost/utility.hpp>
00027 #include <boost/shared_ptr.hpp>
00028 #include <string>
00029 #include <libxml/tree.h>
00030 #include <libxml/xpath.h>
00031 #include "CDMException.h"
00032 #include "XMLDoc.h"
00033
00034 namespace MetNoFimex
00035 {
00036
00037 typedef boost::shared_ptr<xmlXPathObject> XPathObjPtr;
00038
00042 class XMLDoc : boost::noncopyable
00043 {
00044 public:
00045 XMLDoc(const std::string& filename) throw(CDMException);
00046 virtual ~XMLDoc();
00047 XPathObjPtr getXPathObject(const std::string& xpath) const throw(CDMException);
00048
00049 private:
00050 xmlDoc* doc;
00051 xmlXPathContext* xpathCtx;
00052 void cleanup();
00053 };
00054
00060 std::string getXmlProp(const xmlNodePtr node, const std::string& attrName);
00061
00067 std::string getXmlName(const xmlNodePtr node);
00068
00069
00070 }
00071
00072 #endif