*** Lib/xml/dom/minidom.py~ 2004-02-12 18:35:11.000000000 +0100 --- Lib/xml/dom/minidom.py 2005-01-01 20:31:44.000000000 +0100 *************** *** 135,144 **** if newChild.nodeType not in self._child_node_types: raise xml.dom.HierarchyRequestErr( "%s cannot be child of %s" % (repr(newChild), repr(self))) - if newChild.parentNode is not None: - newChild.parentNode.removeChild(newChild) if newChild is oldChild: return try: index = self.childNodes.index(oldChild) except ValueError: --- 135,144 ---- if newChild.nodeType not in self._child_node_types: raise xml.dom.HierarchyRequestErr( "%s cannot be child of %s" % (repr(newChild), repr(self))) if newChild is oldChild: return + if newChild.parentNode is not None: + newChild.parentNode.removeChild(newChild) try: index = self.childNodes.index(oldChild) except ValueError: