Is xml.dom.minidom.Element.cloneNode(deep=True) really fixed already?

Sullivan WxPyQtKinter sullivanz.pku at
Tue Mar 14 02:17:37 CET 2006

Hi, I am now using minidom for my current development. I use cloneNode
method in Element object, but it just does not work. The test code is
very simple as follows:

from xml.dom.minidom import *
print a.toprettyxml()

print b.toprettyxml()
---------------END CODE-------------------
<see i="sullivan"/>

Traceback (most recent call last):
  File "D:\__Apply\", line 10, in -toplevel-
  File "C:\Python24\lib\xml\dom\", line 211, in cloneNode
    return _clone_node(self, deep, self.ownerDocument or self)
  File "C:\Python24\lib\xml\dom\", line 1814, in _clone_node
    if node.ownerDocument.isSameNode(newOwnerDocument):
AttributeError: 'NoneType' object has no attribute 'isSameNode'

--------------result end------------------

Since the prototype of cloneNode is cloneNode(deep), which does not
indicate the type of deep, I also tied other non-None value like
cloneNode(1), cloneNode('a') etc.None of them work.
Referencing the document, I have seen in python 2.0, this function was
very broken. But my Python version is quite up-to-date: version 2.4.1.

Is it a bug still not fixed??

More information about the Python-list mailing list