GNOME Bugzilla – Bug 407389
copyNode does not preserve attributes of XML_XINCLUDE_START node (w/ PATCH)
Last modified: 2009-07-30 15:49:43 UTC
Please describe the problem: After clonning a subtree (using xmlCopyNode internally) the clonned XML_XINCLUDE_START (very useful BTW) nodes do not carry their original attributes (such as href and xpointer). A suggested patch is in the "other info" section. Steps to reproduce: 1. parse a file with <foo><xi:xinclude ...></foo> 2. use xmlCopyNode on <foo/> 3. examine the properties of the XML_XINCLUDE_START node in the copied subtree Actual results: Expected results: Does this happen every time? Other information: --- tree.c~ 2006-10-20 14:54:19.000000000 +0200 +++ tree.c 2007-02-01 15:51:30.000000000 +0100 @@ -3915,7 +3915,8 @@ if (!extended) goto out; - if ((node->type == XML_ELEMENT_NODE) && (node->nsDef != NULL)) + if ((node->type == XML_ELEMENT_NODE || + node->type == XML_XINCLUDE_START) && (node->nsDef != NULL)) ret->nsDef = xmlCopyNamespaceList(node->nsDef); if (node->ns != NULL) { @@ -3942,7 +3943,8 @@ ret->ns = ns; } } - if ((node->type == XML_ELEMENT_NODE) && (node->properties != NULL)) + if ((node->type == XML_ELEMENT_NODE || + node->type == XML_XINCLUDE_START) && (node->properties != NULL)) ret->properties = xmlCopyPropList(ret, node->properties); if (node->type == XML_ENTITY_REF_NODE) { if ((doc == NULL) || (node->doc != doc)) {
Too bad the patch hadn't been provided as an attachement, I would have found it ages ago. I commited it only now, thanks, Daniel