[docs] [issue13127] xml.dom.Attr.name is not labeled as read-only

Dillon Amburgey report at bugs.python.org
Sat Oct 8 06:19:35 CEST 2011

Dillon Amburgey <dillona at dillona.com> added the comment:

The behavior can be verified as follows. Notice that despite changing the value, the output XML does not change

>>> from xml.dom import minidom, Node
>>> a = minidom.parseString("<a href=\"http://asd.com\">asd</a>")
>>> a
<xml.dom.minidom.Document instance at 0x22d7c68>
>>> a.childNodes
[<DOM Element: a at 0x22d7d88>]
>>> a.childNodes[0]
<DOM Element: a at 0x22d7d88>
>>> a.childNodes[0].attributes
<xml.dom.minidom.NamedNodeMap object at 0x21caa70>
>>> a.childNodes[0].attributes.item(0)
<xml.dom.minidom.Attr instance at 0x22d7f38>
>>> a.childNodes[0].attributes.item(0).name
>>> attr = a.childNodes[0].attributes.item(0)
>>> attr.name = "ad"
>>> a.toxml()
u'<?xml version="1.0" ?><a href="http://asd.com">asd</a>'
>>> attr.value = "asd"
>>> a.toxml()
u'<?xml version="1.0" ?><a href="asd">asd</a>'


Python tracker <report at bugs.python.org>

More information about the docs mailing list