[xml] patch: copying unlinked namespaced node



If there are namespaces in an unlinked node which were defined in an ancestor, when copying the node the namespace is just thrown away. The attached patch will reconcile the namespaces in the new node if namespace cant be found in either of the trees.

Rob
diff --git a/tree.c b/tree.c
index 3b66f97..6872209 100644
--- a/tree.c
+++ b/tree.c
@@ -4188,6 +4188,8 @@ xmlStaticCopyNode(const xmlNodePtr node, xmlDocPtr doc, xmlNodePtr parent,
 
                while (root->parent != NULL) root = root->parent;
                ret->ns = xmlNewNs(root, ns->href, ns->prefix);
+               } else {
+                       ret->ns = xmlNewReconciliedNs(doc, ret, node->ns);
            }
        } else {
            /*


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]