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

Fred L. Drake, Jr. fdrake@acm.org
Fri, 2 Aug 2002 12:32:23 -0400


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.

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.

This is the test I used, added to the end of test/test_xmlbuilder.py:

builder.setFeature("namespaces", 0)
run_checks(builder,
           #((nsuri, localName), value),
           [((None, None), "a"),
            ((None, None), "b"),
            ((None, None), "http://xml.python.org/a"),
            ((None, None), "http://xml.python.org/a"),
            ((None, None), "http://xml.python.org/b"),
            ])


  -Fred

-- 
Fred L. Drake, Jr.  <fdrake at acm.org>
PythonLabs at Zope Corporation