En Tue, 29 Apr 2008 23:51:14 -0300, JYA <[EMAIL PROTECTED]> 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

--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to