X-Git-Url: http://sru.miketaylor.org.uk/?a=blobdiff_plain;f=src%2Fxmlutil.cpp;h=ef86b2d0cbcc65a447eb1982147c9963141b197b;hb=e5329397729e8959a821c6956f75012372fc0a77;hp=7e3db5a67a1bbd6aae535149a5ba8000992728a8;hpb=c1d953eee6c00432493bc364da6284704ccd9cc2;p=metaproxy-moved-to-github.git diff --git a/src/xmlutil.cpp b/src/xmlutil.cpp index 7e3db5a..ef86b2d 100644 --- a/src/xmlutil.cpp +++ b/src/xmlutil.cpp @@ -16,11 +16,12 @@ along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ +#include "config.hpp" + #include #include - namespace mp = metaproxy_1; // Doxygen doesn't like mp::xml, so we use this instead namespace mp_xml = metaproxy_1::xml; @@ -45,9 +46,12 @@ std::string mp_xml::get_text(const xmlNode *ptr) bool mp_xml::get_bool(const xmlNode *ptr, bool default_value) { + if (ptr && ptr->type != XML_TEXT_NODE) + ptr = ptr->children; if (ptr && ptr->type == XML_TEXT_NODE && ptr->content) { - if (!strcmp((const char *) ptr->content, "true")) + if (!strcmp((const char *) ptr->content, "true") + || !strcmp((const char *) ptr->content, "1")) return true; else return false; @@ -56,7 +60,9 @@ bool mp_xml::get_bool(const xmlNode *ptr, bool default_value) } int mp_xml::get_int(const xmlNode *ptr, int default_value) -{ +{ + if (ptr && ptr->type != XML_TEXT_NODE) + ptr = ptr->children; if (ptr && ptr->type == XML_TEXT_NODE && ptr->content) { return atoi((const char *) ptr->content);