Wie setze ich die ID eines Elements in Pythons xml.dom.minidom?

Wie man? Erstellt ein Dokument und ein Element:

import xml.dom.minidom as d
a=d.Document()
b=a.createElement('test')

setIdAttribute funktioniert nicht :(

b.setIdAttribute('something')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python2.6/xml/dom/minidom.py", line 835, in setIdAttribute
    self.setIdAttributeNode(idAttr)
  File "/usr/lib/python2.6/xml/dom/minidom.py", line 843, in setIdAttributeNode
    raise xml.dom.NotFoundErr()
xml.dom.NotFoundErr

Und wenn ich dies von Hand setze, kann getElementById es nicht finden.

b.setAttribute('id', 'something')
a.getElementById('something')

Was ich machen muss?

Antworten auf die Frage(2)

Ihre Antwort auf die Frage