Re: xml.dom.minidom weirdness: bug?
- From: "Gabriel Genellina" <gagsl-py2@xxxxxxxxxxxx>
- Date: Wed, 30 Apr 2008 06:46:15 -0300
En Tue, 29 Apr 2008 23:51:14 -0300, JYA <nospam@xxxxxxxxxxx> escribió:
What I'm doing, is read an xml file, create another dom object and copy the element from one to the other.
At no time do I ever modify the original dom object, yet it gets modified.
for y in x.getElementsByTagName('display-name'):
elem.appendChild(y)
tv_xml.appendChild(elem)
You'll note that at no time do I modify the content of docxml, yet it gets modified.
The weirdness disappear if I change the line
channellist = docxml.getElementsByTagName('channel')
to
channellist = copy.deepcopy(docxml.getElementsByTagName('channel'))
However, my understanding is that it shouldn't be necessary.
I think that any element can have only a single parent. If you get an element from one document and insert it onto another document, it gets removed from the first.
--
Gabriel Genellina
.
- References:
- xml.dom.minidom weirdness: bug?
- From: JYA
- xml.dom.minidom weirdness: bug?
- Prev by Date: Re: DO YOU KNOW ANY THING ABOUT ISLAM???
- Next by Date: Re: Code/test ratio wrt static vs dynamic typing [was: Re: Python Success stories]
- Previous by thread: xml.dom.minidom weirdness: bug?
- Next by thread: Re: xml.dom.minidom weirdness: bug?
- Index(es):