xml.dom.minidom weirdness: bug?

Marc Christiansen usenet at solar-empire.de
Wed Apr 30 14:43:28 CEST 2008


JYA <nospam at nospam.blah> wrote:
>                for y in x.getElementsByTagName('display-name'):
>                        elem.appendChild(y)

Like Gabriel wrote, nodes can only have one parent. Use 
  elem.appendChild(y.cloneNode(True))
instead. Or y.cloneNode(False), if you want a shallow copy (i.e. without
any of the children, e.g. text content).

Marc



More information about the Python-list mailing list