Re: Showstopper issue with new Attribute text

Michael Glavassevich <[email protected]> Wed, 17 Mar 2004 14:25:12 -0500
Newsgroups gmane.text.xml.sax.devel
Message-ID <OFCBE0A55D.0D3434C4-ON85256E5A.0067E8FD-85256E5A.006A9E77@ca.ibm.com>
[email protected] wrote on 03/17/2004 01:34:12 PM:

> / Elliotte Rusty Harold <[email protected]> was heard to say:
> [...]
> | The local name property of the attribute information item for an xmlns
> | attribute is xmlns. The prefix property for the attribute information
> | corresponding to an xmlns attribute has no value. Therefore, when SAX
> | reports these I maintain that the local name should be xmlns, not the
> | empty string. The qualified name should also be xmlns. This is still a
> | showstopper issue, even allowing xmlns attributes into the
> | http://www.w3.org/2000/xmlns/ namespace.
> 
> AFAICT, we're in this bind because xmlns things aren't attributes. By
> default, these things don't get reported as attributes, so we're ok.

They are attributes. They're just members of a different set, namely the 
[namespace attributes] property of the element information item to which 
they belong [1]. All of the attributes in this set including one named 
'xmlns' are in the namespace: 'http://www.w3.org/2000/xmlns/'. (This was 
also in the first edition of the infoset).

> If someone has enabled the namespace-prefixes feature, they're asking
> for them to be reported as attributes and we have a problem. For
> declarations of namespaces other than the default namespace, it's
> fairly straightforward:
> 
>   xmlns:foo ==> prefix "xmlns",
>                 local name "foo",
>                 namespace nane "http://www.w3.org/2000/xmlns/"
> 
> The question, then, is what to do with default namespace declarations.
> The current answer:
> 
>   xmlns ==> prefix "xmlns",
>             local name "",
>             namespace nane "http://www.w3.org/2000/xmlns/"
> 
> is incoherent if you look at it as a regular attribute (you can't have
> a name with an empty local name part) but very symmetrical if you look
> at it as a magic quasi-attribute namespace declaration: it's a
> declaration for the empty prefix and in namespace declarations, the
> prefix gets reported in the local name.
> 
> An alternate answer:
> 
>   xmlns ==> prefix "",
>             local name "xmlns",
>             namespace nane "http://www.w3.org/2000/xmlns/"
> 
> is coherent as an attribute, but incoherent from a namespace
> perspective: attribute names without colons are never in a namespace.

This is what I interpret from its description in the infoset: "all 
namespace attributes (including those named xmlns, whose [prefix] property 
has no value) have a namespace URI of http://www.w3.org/2000/xmlns/" [1]. 
I believe that such an attribute has no [prefix], it's [namespace name] is 
'http://www.w3.org/2000/xmlns/' and its [local name] is 'xmlns'. I don't 
believe there's another interpretation which agrees with the spec. While 
all other unprefixed attributes are in no namespace, it specifically 
special cases 'xmlns' placing it in a namespace.

> Another alternative:
> 
>   xmlns ==> prefix "xmlns",
>             local name "xmlns",
>             namespace nane "http://www.w3.org/2000/xmlns/"
> 
> is coherent as both an attribute and a namespace, but it's a
> declaration for the "xmlns" prefix, not the default namespace.
> 
> There's no "right" answer here because namespace declarations aren't
> attributes. I think if you insist on looking at them as attributes,
> the best solution is to deal with the possible special case that the
> local name may be "".
> 
>                                         Be seeing you,
>                                           norm
> 
> -- 
> Norman Walsh <[email protected]> | Part of thinking is its cruelty, aside
> http://nwalsh.com/            | from its contents. It is the process of
>                               | detachment from everything else, the
>                               | ripping, the wrenching, the sharpness
>                               | of cutting.--Elias Canetti

[1] http://www.w3.org/TR/2004/REC-xml-infoset-20040204/#infoitem.element

Michael Glavassevich
XML Parser Development
IBM Toronto Lab
E-mail: [email protected]
E-mail: [email protected]