Re: [xml] Fwd: Patch: Null prefix namespaces not cloned



On Wed, Feb 22, 2006 at 11:17:30AM +1300, Andrew Miller wrote:
Quoting Daniel Veillard <veillard redhat com>:

On Tue, Feb 21, 2006 at 12:53:32PM +1300, Andrew Miller wrote:
Quoting Daniel Veillard <veillard redhat com>:
I don't understand the patch especially the node->doc != doc test, please
elaborate, thanks !

The first check tests for cases where it doesn't make sense to search for
the
namespace, and sets the ns to NULL in those cases. If the prefix is NULL,
it is
clearly not sensible to search for a match by prefix(remember namespace is
defined if we get to that code). The document equality check is there
because
prefixes from one document don't make sense in another document.

   Hum, that copy operation try to preserve the prefix as far as I remember,
you are not changing that, aren't you ?

I agree it might be worth trying the prefix, and then performing an
equality test on the namespaceURI, and only setting ns to NULL if they don't
match. That way, we avoid creating two entries with the same prefix and
namespace where we only need one.

  okay

[...]
So I think that the correct behaviour is to search by namespace and prefix
everywhere. If we don't find a match with the same namespace and prefix, we
create a new namespace object(even if there is another entry with the same
prefix or same URI, but not both the same). This means we can have two
identical prefixes with the same URI, and it is only at serialisation time that
we do anything about it.

I have attached an updated patch that adds a function to search by both
namespace and prefix,

  I don't understand why you need a new function. Search by prefix and
then check the result URI it is associated to, assuming the prefix is
in scope. That avoids duplicating code and adding yet another specialized
API, libxml2 already has too many entry points. I didn't understand the point
your new function, which is possible since you copied over the comment from
the existing prefix based search. It's very easy to get wrong with
namespaces, and there can be only one value of the namespace name for the
prefix in scope, so I don't understand how an API based on both can be
right.
  So please explain the semantic of that function, or use the existing
one and check the namespace name of the return namespace.

Daniel

-- 
Daniel Veillard      | Red Hat http://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]