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

  • Thread starter Sullivan WxPyQtKinter
  • Start date
S

Sullivan WxPyQtKinter

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:

=========CODE==============
from xml.dom.minidom import *
a=Element('see')
print a.toprettyxml()

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


Traceback (most recent call last):
File "D:\__Apply\test8XML.py", line 10, in -toplevel-
b=a.cloneNode(True)
File "C:\Python24\lib\xml\dom\minidom.py", line 211, in cloneNode
return _clone_node(self, deep, self.ownerDocument or self)
File "C:\Python24\lib\xml\dom\minidom.py", 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??
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,009
Latest member
GidgetGamb

Latest Threads

Top