File xml_interface.hpp

This file contains an XML Interface class, which re-interpretates the c style libxml2 interface and maps them to C++ elements. It is meant to parse an XML through the use of XPATH.

Author

Benjamin Lindner ben@benlabs.net

Version

See VERSION in CMakeLists.txt

Copyright

GNU General Public License

class XMLElement
#include <xml_interface.hpp>

Models a XML node and provides convenience functions to access its properties.

Public Functions

XMLElement(xmlNodePtr ptr)
inline void set(xmlNodePtr ptr)
inline xmlElementType type()
inline std::string name()
inline std::string content()
void print(std::string prepend, bool showchildren)
inline xmlNodePtr get_node_ptr()

Public Members

std::vector<XMLElement> children

Private Members

xmlNodePtr node_ptr
class XMLInterface
#include <xml_interface.hpp>

Models a XML file and allows access through XPATH.

Public Functions

XMLInterface(std::string filename)
~XMLInterface()
std::vector<XMLElement> get(const char *xpathexp)
std::vector<XMLElement> get(std::string xpathexp)
void dump(std::vector<char> &c)
template<class convT>
convT get_value(const char *xpathexp)

Provides type safe access to content element in XML files through XPATH.

bool exists(const char *xpathexp)
inline void set_current(XMLElement thisel)

Private Members

xmlDocPtr p_doc
xmlXPathContextPtr p_xpathCtx