[New-bugs-announce] [issue10131] deepcopying an xml.dom.minidom.Document generates an invalid XML document

Florent Xicluna report at bugs.python.org
Sun Oct 17 15:42:20 CEST 2010


New submission from Florent Xicluna <florent.xicluna at gmail.com>:

>>> import copy
>>> from xml.dom import minidom

>>> doc = minidom.parseString('<root/>')
>>> doc2 = copy.deepcopy(doc)

>>> doc.toxml()
u'<?xml version="1.0" ?><root/>'
>>> doc2.toxml()
u'<?xml version="1.0" ?><root/><root/>'
>>> minidom.parseString(doc2.toxml())
Traceback (most recent call last):
...
ExpatError: junk after document element: line 1, column 2


The workaround is to use doc.cloneNode(True).

----------
components: XML
messages: 118942
nosy: flox
priority: normal
severity: normal
stage: needs patch
status: open
title: deepcopying an xml.dom.minidom.Document generates an invalid XML document
type: behavior
versions: Python 2.7, Python 3.1, Python 3.2

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue10131>
_______________________________________


More information about the New-bugs-announce mailing list