12 #include <libxml/parser.h>
13 #include <libxml/tree.h>
25 void openFile(
const std::string &fileName );
29 xmlNodePtr
getCheckChild( xmlNodePtr parent,
const std::string &name,
bool force =
true )
const;
33 xmlNodePtr
getCheckSibling( xmlNodePtr parent,
const std::string &name,
bool force =
true )
const;
36 xmlNodePtr
getCheckRoot(
const std::string &name )
const;
39 bool checkAttribute( xmlNodePtr parent,
const std::string &name,
const std::string &expectedVal )
const;
42 void checkAttribute( xmlNodePtr parent,
const std::string &name,
const std::string &expectedVal,
const std::string &err )
const;
45 void checkEqual(
const xmlChar *xmlString,
const std::string &str,
const std::string &err )
const;
48 bool checkEqual(
const xmlChar *xmlString,
const std::string &str )
const;
51 std::string
attribute( xmlNodePtr node, std::string name )
const;
60 std::string
content( xmlNodePtr node )
const;
63 xmlNodePtr
root()
const;
66 std::string
toString(
const xmlChar *xmlString )
const;
70 [[ noreturn ]]
void error(
const std::string &str )
const;
73 std::string mFileName;
C++ Wrapper around libxml2 library.
Definition: mdal_xml.hpp:17
~XMLFile()
Closes the file.
Definition: mdal_xml.cpp:40
XMLFile()
Create file with invalid handle.
std::string attribute(xmlNodePtr node, std::string name) const
Gets string attribute.
Definition: mdal_xml.cpp:188
xmlNodePtr getCheckSibling(xmlNodePtr parent, const std::string &name, bool force=true) const
Gets next sibling with a correct name if force, throws an exception if not found.
Definition: mdal_xml.cpp:108
size_t querySizeTAttribute(xmlNodePtr elem, std::string name) const
Gets size_t attribute.
Definition: mdal_xml.cpp:181
std::string content(xmlNodePtr node) const
Gets element text.
Definition: mdal_xml.cpp:203
double queryDoubleAttribute(xmlNodePtr elem, std::string name) const
Gets double attribute.
Definition: mdal_xml.cpp:174
std::string toString(const xmlChar *xmlString) const
Converts xmlString to string.
Definition: mdal_xml.cpp:164
xmlNodePtr getCheckChild(xmlNodePtr parent, const std::string &name, bool force=true) const
Gets next child with a correct name if force, throws an exception if not found.
Definition: mdal_xml.cpp:88
bool checkAttribute(xmlNodePtr parent, const std::string &name, const std::string &expectedVal) const
Checks if attribute matches the string.
Definition: mdal_xml.cpp:128
void openFile(const std::string &fileName)
Opens the XML file.
Definition: mdal_xml.cpp:54
xmlNodePtr root() const
Gets root element.
Definition: mdal_xml.cpp:153
void checkEqual(const xmlChar *xmlString, const std::string &str, const std::string &err) const
Checks strings are equal. Throws exception.
Definition: mdal_xml.cpp:64
xmlNodePtr getCheckRoot(const std::string &name) const
Gets root element and check that has correct name.
Definition: mdal_xml.cpp:81