[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]
[xml] copyNode and attributes of XML_XINCLUDE_START
- From: Petr Pajas <pajas ufal mff cuni cz>
- To: libxml2 <xml gnome org>
- Subject: [xml] copyNode and attributes of XML_XINCLUDE_START
- Date: Thu, 1 Feb 2007 16:03:38 +0100
Hi Daniel, All,
one of the users of the Perl bindings has noticed that 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).
The attached patch for tree.c fixes this. I'm not sure if
XML_XINCLUDE_END can ever carry properties; if not, safely remove
the 2 corresponding lines from the patch.
Thanks in advance for considering the patch,
-- Petr
--- tree.c~ 2006-10-20 14:54:19.000000000 +0200
+++ tree.c 2007-02-01 15:51:30.000000000 +0100
@@ -3915,7 +3915,9 @@
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->type == XML_XINCLUDE_END) && (node->nsDef != NULL))
ret->nsDef = xmlCopyNamespaceList(node->nsDef);
if (node->ns != NULL) {
@@ -3942,7 +3944,9 @@
ret->ns = ns;
}
}
- if ((node->type == XML_ELEMENT_NODE) && (node->properties != NULL))
+ if ((node->type == XML_ELEMENT_NODE ||
+ node->type == XML_XINCLUDE_START ||
+ node->type == XML_XINCLUDE_END) && (node->properties != NULL))
ret->properties = xmlCopyPropList(ret, node->properties);
if (node->type == XML_ENTITY_REF_NODE) {
if ((doc == NULL) || (node->doc != doc)) {
[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]