By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
445,909 Members | 2,016 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 445,909 IT Pros & Developers. It's quick & easy.

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

P: n/a
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??

Mar 14 '06 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.