From 687eeb015b72c115957f4b7f342e9d0bb9a45a5f Mon Sep 17 00:00:00 2001 From: Mattia Basaglia Date: Mon, 24 Nov 2014 17:54:03 +0100 Subject: [PATCH] Allow loading attributes --- svvm_cmds.c | 2 +- xml.c | 13 +++++++++++++ xml.h | 1 + 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/svvm_cmds.c b/svvm_cmds.c index 16d91e9c..84338c83 100644 --- a/svvm_cmds.c +++ b/svvm_cmds.c @@ -3320,7 +3320,7 @@ VM_xml_tree_has_sibling, // #135 VM_xml_tree_next, // #136 VM_xml_tree_type, // #137 VM_xml_tree_root, // #138 -NULL, // #139 +VM_xml_tree_attribute, // #139 NULL, // #140 NULL, // #141 NULL, // #142 diff --git a/xml.c b/xml.c index 24ae92f9..20cf0d7b 100644 --- a/xml.c +++ b/xml.c @@ -244,4 +244,17 @@ void VM_xml_tree_root(prvm_prog_t *prog) if ( !xml ) return; xml->node = xmlDocGetRootElement(xml->doc); +} + +void VM_xml_tree_attribute(prvm_prog_t *prog) +{ + qxml_p xml; + VM_XML_CHECK_RETURN(VM_xml_tree_type, PRVM_G_FLOAT(OFS_RETURN) = 0); + if ( !xml->attribute && xml->node->properties ) + { + PRVM_G_FLOAT(OFS_RETURN) = 1; + xml->attribute = xml->node->properties; + } + else + PRVM_G_FLOAT(OFS_RETURN) = 0; } \ No newline at end of file diff --git a/xml.h b/xml.h index e0155cd6..da9702db 100644 --- a/xml.h +++ b/xml.h @@ -14,6 +14,7 @@ void VM_xml_tree_has_sibling(prvm_prog_t *prog); void VM_xml_tree_next(prvm_prog_t *prog); void VM_xml_tree_type(prvm_prog_t *prog); void VM_xml_tree_root(prvm_prog_t *prog); +void VM_xml_tree_attribute(prvm_prog_t *prog); void XML_Close(prvm_prog_t *prog, int index); -- 2.39.2