Re: [xml] xmlStaticCopyNode and namespaces
- From: Daniel Veillard <veillard redhat com>
- To: Charlie Bozeman <cbozeman HiWAAY net>
- Cc: xml gnome org
- Subject: Re: [xml] xmlStaticCopyNode and namespaces
- Date: Sun, 13 Jan 2002 16:31:28 -0500
On Wed, Jan 09, 2002 at 10:04:51PM -0600, Charlie Bozeman wrote:
My application copies branches from one part of a document to another
part using xmlDocCopyNode. Later when processing the new branches the
test for namespace equality fails:
if (node->ns == ns)
Well you should really test namespace equality by comparing the
namespace names (i.e. the URI string associated to the namespace node).
This failure is because the new branch nodes namespaces are copies of
the original namespace i.e. the namespace contents are equal but the
pointers are different. I traced the problem to xmlStaticCopyNode
starting at 2794:
[...]
The attached patch checks if the intended copy is an out-of-tree copy
before making copies of the namespaces.
Hum, the patch seems to simply drop namespace lookups in the target tree.
This seems a serious error. If you copy a node from one part of the
tree to another part of the tree where the namespace declaration
is not in scope anymore, then you end up with a broken document w.r.t.
namespaces.
The current code might generate too many namespace nodes, but it
should not generate broken namespaces use while the declaration is not
in scope. And I certainly prefer the current behaviour to the one
provided by your patch.
Now if you can provide a patch which maintains both then I would
accept it,
thanks,
Daniel
--
Daniel Veillard | Red Hat Network https://rhn.redhat.com/
veillard redhat com | libxml Gnome XML XSLT toolkit http://xmlsoft.org/
http://veillard.com/ | Rpmfind RPM search engine http://rpmfind.net/
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]