classification
Title: instantiating and populating xml.dom.minidom.Element is cumbersome
Type: enhancement Stage: needs patch
Components: Library (Lib) Versions: Python 3.2
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: BreamoreBoy, exarkun
Priority: normal Keywords:

Created on 2009-01-05 19:08 by exarkun, last changed 2010-07-27 20:19 by BreamoreBoy.

Messages (3)
msg79183 - (view) Author: Jean-Paul Calderone (exarkun) * (Python committer) Date: 2009-01-05 19:08
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.
msg108192 - (view) Author: Mark Lawrence (BreamoreBoy) Date: 2010-06-19 18:11
As you Jean-Paul Calderone seem to know what you're talking about could you provide a patch to get this issue going?  If not I might even have a go myself, even if I do get shot down in flames.
msg111724 - (view) Author: Mark Lawrence (BreamoreBoy) Date: 2010-07-27 20:19
I think this could be sneaked into 3.2 if needed, but is it more work than the benefits actually deliver in the real world?
History
Date User Action Args
2010-07-27 20:19:10BreamoreBoysettype: behavior -> enhancement
stage: needs patch
messages: + msg111724
versions: + Python 3.2
2010-06-19 18:11:02BreamoreBoysetnosy: + BreamoreBoy
messages: + msg108192
2009-01-05 19:08:25exarkuncreate