summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFrederic Peters <fpeters@entrouvert.com>2004-11-25 14:24:18 +0000
committerFrederic Peters <fpeters@entrouvert.com>2004-11-25 14:24:18 +0000
commita7bf65c7d385de2bda49b392fc8ce90978f5c909 (patch)
treea19fd85f2e421211f424346912363c2ca641f3b6
parentae5ffe04683d76083578d293a771f0459966932e (diff)
added xml attribute support to xmlsnippet
-rw-r--r--lasso/xml/xml.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/lasso/xml/xml.c b/lasso/xml/xml.c
index 2520bfab..21552c64 100644
--- a/lasso/xml/xml.c
+++ b/lasso/xml/xml.c
@@ -728,6 +728,11 @@ lasso_node_init_xml_with_snippets(xmlNode *node, struct XmlSnippet *snippets)
xmlNode *t;
int i;
+ for (i = 0; snippets[i].name; i++) {
+ if (snippets[i].type == 'a') /* attribute */
+ *(snippets[i].value) = xmlGetProp(node, snippets[i].name);
+ }
+
t = node->children;
for (t = node->children; t; t = t->next) {
if (t->type != XML_ELEMENT_NODE)
@@ -757,6 +762,13 @@ lasso_node_build_xml_with_snippets(xmlNode *node, struct XmlSnippet *snippets)
for (i = 0; snippets[i].name; i++) {
if (*(snippets[i].value) == NULL)
continue;
+ if (snippets[i].type == 'a') /* attribute */
+ xmlSetProp(node, snippets[i].name, (char*)(*(snippets[i].value)));
+ }
+
+ for (i = 0; snippets[i].name; i++) {
+ if (*(snippets[i].value) == NULL)
+ continue;
if (snippets[i].type == 'n')
xmlAddChild(node, lasso_node_get_xmlNode(
LASSO_NODE(*(snippets[i].value))));