diff options
Diffstat (limited to 'src/utils/xml.cpp')
-rw-r--r-- | src/utils/xml.cpp | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/src/utils/xml.cpp b/src/utils/xml.cpp index 9835f88c..bb386f51 100644 --- a/src/utils/xml.cpp +++ b/src/utils/xml.cpp @@ -21,15 +21,19 @@ #include "utils/xml.h" +#include <iostream> +#include <fstream> +#include <cstring> + +#include <libxml/parser.h> +#include <libxml/xmlerror.h> + #include "log.h" #include "resources/resourcemanager.h" #include "utils/zlib.h" -#include <libxml/parser.h> -#include <libxml/xmlerror.h> - namespace XML { static void xmlLogger(void *ctx, xmlErrorPtr error); @@ -129,6 +133,15 @@ namespace XML return def; } + bool getBoolProperty(xmlNodePtr node, const char* name, bool def) + { + xmlChar *prop = xmlGetProp(node, BAD_CAST name); + + if (xmlStrEqual(prop, BAD_CAST "true" ) ) return true; + if (xmlStrEqual(prop, BAD_CAST "false") ) return false; + return def; + } + xmlNodePtr findFirstChildByName(xmlNodePtr parent, const char *name) { for_each_xml_child_node(child, parent) |