[XML-SIG] No parents in cloned node?
Adam Clark
bjrubble@dagobah.com
Fri, 14 Jul 2000 15:42:33 -0700 (PDT)
Hi,
Please let me know if this is the wrong list for this.
So you clone a node, it has no parent. That makes sense. But the cloned
node's children also have no parents. Is there a reason for this?
>>> print node.toxml()
<TD VALIGN='MIDDLE' ALIGN='LEFT' WIDTH='30'><IMG HEIGHT='25' BORDER='0'
ALT='' WIDTH='22' SRC='/gif/mn_clear.gif' /></TD>
>>> print node.firstChild.parentNode
<Element 'TD'>
>>> node2 = node.cloneNode(1)
>>> print node2.toxml()
<TD VALIGN='MIDDLE' ALIGN='LEFT' WIDTH='30'><IMG HEIGHT='25' BORDER='0'
ALT='' WIDTH='22' SRC='/gif/mn_clear.gif' /></TD>
>>> print node2.firstChild.parentNode
None
I just want to say 'node.parent.removeChild( node )' -- ie. remove a node
from a cloned branch, without knowing what the parent is. Is there some
alternative I can use?
Thanks
Adam