X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=c%2B%2B11%2Fxml-template.cpp;h=4f0c9fef6e903aa4a9772de64e176d612dd3c291;hb=1725768e2eaf68a1445f1aef9d95da0bf461e88b;hp=503e5e329d4f7269a8115c1c1df20114705b4819;hpb=67503cff975c04009dd3658c50cd9a4bf3a39ec5;p=xml-template diff --git a/c++11/xml-template.cpp b/c++11/xml-template.cpp index 503e5e3..4f0c9fe 100644 --- a/c++11/xml-template.cpp +++ b/c++11/xml-template.cpp @@ -14,12 +14,11 @@ void clean_node(xmlNode *node) } if (node->ns != NULL && strcmp(reinterpret_cast(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); } }