Re: [gdome]ownerElement of libxml2 namespace



On Tue, Jan 15, 2002 at 10:48:50PM -0500, T.J. Mather wrote:
> Hi,
> 
> This might be more of a question for the xml gnome org mailing list, but I 
> thought I would try it here first, since it relates to gdome2.
> 
> It would be useful to have to have an additional member of the xmlNs 
> struct in libxml2:
> 
> struct _xmlNode		*elem;   /* owner Element */

  Well I know but it's more complex than you imagine ... First
I can't break binary compatibility.

> It would be useful for two purposes in libgdome:
> 
> 1. For completing the XPath module.  One of the attributes of 
> XPathNamespace is ownerElement:
> >From 
> http://www.w3.org/TR/2001/WD-DOM-Level-3-XPath-20011031/xpath.html#XPathNamespace
> 
> ownerElement of type Element, readonly 
>   The Element on which the namespace was in scope when it was requested.
>   This does not change on a returned namespace node even if the document
>   changes such that the namespace goes out of scope on that element and this
>   node is no longer found there by XPath.

  And it would not provide that semantic !
An xmlNode in libxml is a namespace declaration node i.e. the equivalent
of the attribute node "xmlns..." 
This does not match the XPath data model. In the XPath data model for any
element you have a set of nodes which represent every namespaces in scope.
To see them at the libxml level they are recomputed dynamically when exploring
the namespace:: axis, but the returned values are the associated namespace
declaration nodes, not "faked" XPath namespace nodes. As a result the
libxml2 XPath implementation diverges from the spec because namespace
nodes have no parent.
     http://bugzilla.gnome.org/show_bug.cgi?id=61290

> we would also get the ownerDocument attribute from this.
> 
> 2. For proper memory management with namespace nodes.  We need to know the 
> document that contains the namespace so we know when we can delete a
> document tree.  If we had ownerElement, then we could find the owner
> document.

  Right, that would still make sense. Unfortunately this change would
introduce a binary incompatibility at the libxml2 shared library level
and I'm not allowed to do this at the moment.

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]