[XML-SIG] Element.localName, Attr.localName

Martin v. Loewis martin@v.loewis.de
03 Aug 2002 11:31:27 +0200


"Fred L. Drake, Jr." <fdrake@acm.org> writes:

> Consider this XML 1.0 document:
> 
> <doc xmlns:a="http://xml.python.org/a"
>      xmlns:A="http://xml.python.org/a"
>      xmlns:b="http://xml.python.org/b"
>      a:a="a" b:b="b"
>      />
> 
> This is just XML 1.0, no namespaces!

Why do you say that this document has no namespaces? It looks to me
like it has!

It may be that an application is not *aware* of the namespaces, but
they surely are present.

> As I read it, the DOM for this should have 5 attribute nodes:
> 
>     nodeName/name    nodeValue/value
>     -------------    -----------------------
>     a:a              a
>     b:b              b
>     xmlns:A          http://xml.python.org/a
>     xmlns:a          http://xml.python.org/a
>     xmlns:b          http://xml.python.org/b
> 
> 
> The localName, namespaceURI, and prefix for each should be None.

That is not true. In DOM Level 2 and onwards, that should be

nodeName localName namespaceURI                   prefix
a:a      a         http://xml.python.org/a        a
b:b      b         http://xml.python.org/b        b
xmlns:A  A         http://www.w3.org/2000/xmlns/  xmlns
xmlns:a  a         http://www.w3.org/2000/xmlns/  xmlns
xmlns:b  b         http://www.w3.org/2000/xmlns/  xmlns

> builder.setFeature("namespaces", 0)

Ah, you are turning off the feature "namespaces". I don't think the
Load/Store spec says precisely what that means for load - it only says
what that means for store. One could, of course, guess that it means
to set all those attributes to null - in which case your
interpretation would be correct.

Notice, however, that the pre-LS-builders are supposed to do the
equivalent of the namespaces feature being activated.

Regards,
Martin