[XML-SIG] Bug in xml.dom.minidom.NamedNodeMap ?

Henry James henrypijames at lycos.com
Thu Dec 15 02:09:46 CET 2005

According to the documentation, xml.dom.minidom.NamedNodeMap has "experimental methods that give this class more mapping behavior". But this is what happens:

>>> import xml.dom.minidom
>>> s = '<?xml version="1.0" encoding="UTF-8"?><root><node_1 attr_1="1" attr_2="2"/><node_2/></root>'
>>> n = xml.dom.minidom.parseString(s).documentElement.firstChild
>>> n.attributes.keys()
[u'attr_2', u'attr_1']
>>> [a for a in n.attributes]
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
  File "/usr/lib/python2.4/xml/dom/minidom.py", line 529, in __getitem__
KeyError: 0

I can't quite understand why access to a key "0" is being attempted here.


Search for businesses by name, location, or phone number.  -Lycos Yellow Pages


More information about the XML-SIG mailing list