]> git.sesse.net Git - xml-template/commitdiff
In the C++11 version, fix a bug with node removal that would cause an inconsistent...
authorsgunderson@bigfoot.com <>
Sat, 24 Sep 2011 11:27:32 +0000 (13:27 +0200)
committersgunderson@bigfoot.com <>
Sat, 24 Sep 2011 11:27:32 +0000 (13:27 +0200)
c++11/xml-template.cpp

index 503e5e329d4f7269a8115c1c1df20114705b4819..4f0c9fef6e903aa4a9772de64e176d612dd3c291 100644 (file)
@@ -14,12 +14,11 @@ void clean_node(xmlNode *node)
        }
        if (node->ns != NULL &&
            strcmp(reinterpret_cast<const char *>(node->ns->href), "http://template.sesse.net/") == 0) {
-               xmlNode *frag = xmlNewDocFragment(node->doc);
-               xmlReplaceNode(node, frag);
-               frag->children = node->children;
-               frag->last = node->last;
+               while (node->children != NULL) {
+                       xmlAddPrevSibling(node, node->children);
+               }
 
-               node->children = node->last = NULL;
+               xmlUnlinkNode(node);
                xmlFreeNode(node);
        }
 }