New submission from Jean-Paul Calderone <exar...@divmod.com>: It seems impossible to clone an Element created without a document:
>>> Element('foo').cloneNode(False) Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/usr/lib/python2.5/xml/dom/minidom.py", line 211, in cloneNode return _clone_node(self, deep, self.ownerDocument or self) File "/usr/lib/python2.5/xml/dom/minidom.py", line 1814, in _clone_node if node.ownerDocument.isSameNode(newOwnerDocument): AttributeError: 'NoneType' object has no attribute 'isSameNode' The documentation claims that cloneNode was fixed for releases "subsequent" to 2.0, but this doesn't appear to be true. http://docs.python.org/library/xml.dom.minidom.html#xml.dom.minidom.Node.cloneNode A similar issue occurs when attempting to import a node into a document (something I tried as a work-around for this failure): >>> d.importNode(e, False) Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/usr/lib/python2.5/xml/dom/minidom.py", line 1737, in importNode return _clone_node(node, deep, self) File "/usr/lib/python2.5/xml/dom/minidom.py", line 1814, in _clone_node if node.ownerDocument.isSameNode(newOwnerDocument): AttributeError: 'NoneType' object has no attribute 'isSameNode' ---------- components: Library (Lib) messages: 79203 nosy: exarkun severity: normal status: open title: xml.dom.minidom.Element.cloneNode fails with AttributeError type: behavior _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue4851> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com