[issue4849] instantiating and populating xml.dom.minidom.Element is cumbersome

Jean-Paul Calderone report at bugs.python.org
Mon Jan 5 20:08:35 CET 2009


New submission from Jean-Paul Calderone <exarkun at divmod.com>:

In order to create an element with an attribute and a child, this is
necessary:

    e = Element("foo")
    e.setAttribute("bar", "baz")
    e.appendChild(quux)

It would be preferable if Element.__init__ accepted two additional
parameters to shorten this:

    e = Element("foo", attributes={"bar": "baz"}, children=[quux])

It may also be preferable to have a third new parameter, attributesNS,
to parallel the Element.setAttributeNS method.  This would accept a dict
mapping namespaceURI and qualifiedName to an attribute value.

----------
components: Library (Lib)
messages: 79183
nosy: exarkun
severity: normal
status: open
title: instantiating and populating xml.dom.minidom.Element is cumbersome
type: behavior

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue4849>
_______________________________________


More information about the Python-bugs-list mailing list