Re: [xml] patch: copying unlinked namespaced node

On Fri, Jan 29, 2010 at 07:14:29AM -0500, Rob Richards wrote:
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.


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 {

  Okay, ACK

   thanks !


Daniel Veillard      | libxml Gnome XML XSLT toolkit
daniel veillard com  | Rpmfind RPM search engine | virtualization library

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