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.

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 {
          /*

  Okay, ACK

   thanks !

Daniel

-- 
Daniel Veillard      | libxml Gnome XML XSLT toolkit  http://xmlsoft.org/
daniel veillard com  | Rpmfind RPM search engine http://rpmfind.net/
http://veillard.com/ | virtualization library  http://libvirt.org/



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