Bug in xml.dom.minidom.NamedNodeMap ?

"Henry James" <[email protected]>
Newsgroups gmane.comp.python.xml
Message-ID <[email protected]>
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

http://r.lycos.com/r/yp_emailfooter/http://yellowpages.lycos.com/default.asp?SRC=lycos10

_______________________________________________
XML-SIG maillist  -  [email protected]
http://mail.python.org/mailman/listinfo/xml-sig
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.