After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 407389 - copyNode does not preserve attributes of XML_XINCLUDE_START node (w/ PATCH)
copyNode does not preserve attributes of XML_XINCLUDE_START node (w/ PATCH)
Status: RESOLVED FIXED
Product: libxml2
Classification: Platform
Component: general
git master
Other All
: Normal normal
: ---
Assigned To: Daniel Veillard
libxml QA maintainers
Depends on:
Blocks:
 
 
Reported: 2007-02-13 08:46 UTC by Petr Pajas
Modified: 2009-07-30 15:49 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Petr Pajas 2007-02-13 08:46:17 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)) {
Comment 1 Daniel Veillard 2009-07-30 15:49:43 UTC
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