summaryrefslogtreecommitdiff
path: root/src/utils/xml.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/utils/xml.cpp')
-rw-r--r--src/utils/xml.cpp23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/utils/xml.cpp b/src/utils/xml.cpp
index 7c917dc0..e30450f0 100644
--- a/src/utils/xml.cpp
+++ b/src/utils/xml.cpp
@@ -39,6 +39,20 @@ namespace XML
return ret;
}
+ double
+ getFloatProperty(xmlNodePtr node, const char* name, double def)
+ {
+ double &ret = def;
+
+ xmlChar *prop = xmlGetProp(node, BAD_CAST name);
+ if (prop) {
+ ret = atof((char*)prop);
+ xmlFree(prop);
+ }
+
+ return ret;
+ }
+
std::string
getProperty(xmlNodePtr node, const char *name, const std::string &def)
{
@@ -51,4 +65,13 @@ namespace XML
return def;
}
+
+ xmlNodePtr findFirstChildByName(xmlNodePtr parent, const char *name)
+ {
+ for_each_xml_child_node(child, parent)
+ if (xmlStrEqual(child->name, BAD_CAST name))
+ return child;
+
+ return NULL;
+ }
}