diff options
Diffstat (limited to 'src/utils/xml.cpp')
-rw-r--r-- | src/utils/xml.cpp | 25 |
1 files changed, 21 insertions, 4 deletions
diff --git a/src/utils/xml.cpp b/src/utils/xml.cpp index 9835f88c..65eb1370 100644 --- a/src/utils/xml.cpp +++ b/src/utils/xml.cpp @@ -21,15 +21,20 @@ #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/stringutils.h" #include "utils/zlib.h" -#include <libxml/parser.h> -#include <libxml/xmlerror.h> - namespace XML { static void xmlLogger(void *ctx, xmlErrorPtr error); @@ -129,6 +134,18 @@ namespace XML return def; } + bool getBoolProperty(xmlNodePtr node, const char* name, bool def) + { + bool ret = def; + xmlChar *prop = xmlGetProp(node, BAD_CAST name); + if (prop) + { + ret = getBoolFromString((char*) prop, def); + xmlFree(prop); + } + return ret; + } + xmlNodePtr findFirstChildByName(xmlNodePtr parent, const char *name) { for_each_xml_child_node(child, parent) @@ -149,7 +166,7 @@ namespace XML logger->log("Error in unknown xml file on line %d", error->line); - logger->log(error->message); + logger->log("%s", error->message); // No need to keep errors around xmlCtxtResetLastError(error->ctxt); |