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 "fimex/CDMException.h"
00032 #include "fimex/XMLDoc.h"
00033
00034 namespace MetNoFimex
00035 {
00036
00037 typedef boost::shared_ptr<xmlXPathObject> XPathObjPtr;
00038
00042 class XMLDoc : boost::noncopyable
00043 {
00044 public:
00051 XMLDoc(const std::string& filename) throw(CDMException);
00052 virtual ~XMLDoc();
00060 XPathObjPtr getXPathObject(const std::string& xpath) const throw(CDMException);
00061
00062 private:
00063 xmlDoc* doc;
00064 xmlXPathContext* xpathCtx;
00065 void cleanup();
00066 };
00067
00073 std::string getXmlProp(const xmlNodePtr node, const std::string& attrName);
00074
00080 std::string getXmlName(const xmlNodePtr node);
00081
00082
00083 }
00084
00085 #endif