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

Jeremy Kloth jeremy.kloth@fourthought.com
Fri, 2 Aug 2002 11:29:40 -0600


----- Original Message -----
From: "Fred L. Drake, Jr." <fdrake@acm.org>
To: "XML-SIG" <xml-sig@python.org>
Sent: Friday, August 02, 2002 10:32 AM
Subject: [XML-SIG] Element.localName, Attr.localName


>
> 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!
>
> 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 depends on whether the NS methods were was to create them.

> Unfortunately, xml.dom.minidom was broken in a late checkin, and
> localName gets a non-None value for all of these.
>
> Am I understanding the DOM specification wrong, or is this really
> broken?  I can fix it if this is indeed broken.

Only if they were added through the non-NS methods.  However a quick scan
through minidom reveals that localName is formed on-the-fly by splitting on
':'.  So I guess it is indeed broken.

--
Jeremy Kloth
jeremy.kloth@fourthought.com
Fourthought, Inc.
http://fourthought.com, http://4suite.org