[Python-bugs-list] [Bug #116677] minidom:Node.appendChild() has wrong semantics

noreply@sourceforge.net noreply@sourceforge.net
Wed, 11 Oct 2000 19:55:00 -0700


Bug #116677, was updated on 2000-Oct-11 19:24
Here is a current snapshot of the bug.

Project: Python
Category: Library
Status: Open
Resolution: None
Bug Group: None
Priority: 7
Summary: minidom:Node.appendChild() has wrong semantics

Details: Consider this test program:

from xml.dom import minidom
doc = minidom.Document()
root = doc.createElement('root') ; doc.appendChild( root )

elem = doc.createElement('leaf')
root.appendChild( elem )
root.appendChild( elem )

print doc.toxml()
print root.childNodes

It prints:
<root><leaf/><leaf/></root>
[<DOM Element: leaf at 135586476>, <DOM Element: leaf at 135586476>]

'elem' is now linked into the DOM tree in two places, which is wrong; according to the DOM Level 1 spec, 
"If the newChild is already in the tree, it is first removed."



Follow-Ups:

Date: 2000-Oct-11 19:55
By: fdrake

Comment:
Andrew:  Are you using 2.0c1 or CVS?
-------------------------------------------------------

For detailed info, follow this link:
http://sourceforge.net/bugs/?func=detailbug&bug_id=116677&group_id=5470