Re: [xml] libxml2 and default namespaces



On Sat, Dec 10, 2005 at 09:04:42PM +0100, Paul Boddie wrote:
  I didn't check further, this sounds completely flawed from the start.

That setting a namespace on an element and then producing a serialisation of a 
document without any declarations is flawed, you mean?

  there is 2 things:
    - declaration of a namespace, i.e. presence of an xmlns... attribute
    - usage of a namespace

There are constraints to both:
    - usage: the namespace must be in scope i.e. declared on a parent
      element (and no cancellation in XML-1.1) ...
    - declaration: the namespace must be declared on an element, 
      no duplication of anamespaces on that element, ....

You can certainly build in memory trees where this is broken, a memory
tree is not XML, XML is *only* defined as a criteria for a serialization,
a set of continuous bytes in a stream. Same for namespaces, they are only
defined as XML criteria, i.e. again as a set of serialization check.

DOM is irrelevant, what matters is XML. Libxml2 does not implement DOM.
If you're discussing about whether an API allows somthings in a memory
tree, then that's not XML, it's irrelevant. If you are discussing about 
how an instance looks like, then XML is a normative prose which tells
what is flawed and what is not.

Your example had a serialization without the xmlns, so there is no namespace
from an XML perspective. Anything else is discussions about implementations,
are implementation specific and not normative from my point of view.

And yes in libxml2 you may produce a broken in-memory tree where the node
ns pointer points to a namespace not in scope, it's a bug or a temporary state
of the tree. Discussing whether this is right or not is again irrelevant
because the only important point is the serialization, i.e. where you need 
interoperability.

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]