16 #ifndef LIBXML2_DOCUMENT_H 17 #define LIBXML2_DOCUMENT_H 19 #include <libxml/xpath.h> 21 #include <string_view> 51 void put(
const char* expression, xmlXPathContextPtr context);
61 return result->nodesetval->nodeTab[i];
82 void newDoc(
const std::string& rootName);
84 bool parse(
const std::string& fname);
91 void dump(
const std::string& newxml);
94 void addChild(
const std::string& expression, xmlNodePtr newnode);
97 xmlNodePtr
addChild(xmlNodePtr parent,
const std::string& nodeName);
99 xmlNodePtr
addChild(xmlNodePtr parent,
const std::string& nodeName,
const bool& value)
101 std::string
s = value ?
"true" :
"false";
102 xmlNodePtr
node = xmlNewChild(parent, NULL, BAD_CAST nodeName.c_str(), BAD_CAST
s.c_str());
107 xmlNodePtr
addChild(xmlNodePtr parent,
const std::string& nodeName,
const T& value)
111 xmlNodePtr
node = xmlNewChild(parent, NULL, BAD_CAST nodeName.c_str(), BAD_CAST
s.str().c_str());
class that handles xmlDoc
if(!okay) throw std xmlNodePtr node
xmlXPathContextPtr getXPathContext()
void newDoc(const std::string &rootName)
A collection of put/get functions to read from or write to a xmlNode defined in libxml2.
class to handle xmlXPathObject
void put(const char *expression, xmlXPathContextPtr context)
evaluate the expression and create the object
xmlXPathContextPtr m_context
xmlNodePtr addChild(xmlNodePtr parent, const std::string &nodeName, const bool &value)
xmlXPathContextPtr m_context
xmlNodePtr operator[](int i)
bool parseFromString(const std::string_view data)
void addChild(xmlNodePtr newnode)
bool parse(const std::string &fname)
xmlNodePtr addChild(xmlNodePtr parent, const std::string &nodeName, const T &value)
void dump(const std::string &newxml)