From 673e88cf029eb0219f5b6989d5e57f839ab6771f Mon Sep 17 00:00:00 2001 From: Ben Kibbey Date: Sun, 23 Dec 2007 08:58:12 -0500 Subject: [PATCH] Another STORE command fix to hopefully fix what commit a118653 was supposed to. --- src/xml.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/xml.c b/src/xml.c index 4fc2cbc8..a41f2cf7 100644 --- a/src/xml.c +++ b/src/xml.c @@ -308,7 +308,8 @@ xmlNodePtr create_target_elements_cb(xmlNodePtr node, gchar **path, for (i = 0; req[i]; i++) { xmlNodePtr n; - if ((n = find_element(node, req[i], find_stop_node(node))) == NULL) { + if ((n = find_element(node, req[i], find_stop_node(node))) == NULL || + (n && n->parent == node->parent)) { is_literal_element(&req[i]); n = xmlNewNode(NULL, (xmlChar *)req[i]); @@ -389,6 +390,14 @@ xmlNodePtr create_elements_cb(xmlNodePtr node, gchar **elements, n = find_element(node, req[i], find_stop_node(node)); + /* + * If the found element has the same parent as the current element, + * they are siblings and the new element needs to be created as a + * child of the current element (node). + */ + if (n && n->parent == node->parent) + n = NULL; + if (!n) { n = xmlNewNode(NULL, (xmlChar *)req[i]); -- 2.11.4.GIT