[XML-SIG] [Bug #125043] Losing attributes when cloning an element

noreply@sourceforge.net noreply@sourceforge.net
Fri, 8 Dec 2000 16:26:51 -0800


Bug #125043, was updated on 2000-Dec-08 16:26
Here is a current snapshot of the bug.

Project: Python/XML
Category: 4Suite
Status: Open
Resolution: None
Bug Group: None
Priority: 5
Submitted by: jkloth
Assigned to : nobody
Summary: Losing attributes when cloning an element

Details: I ran into a bug with cloning non-namespace XML Elements with
attributes,
illustrated by the following testcase:

>>> from xml.dom.Document import Document
>>> dom=Document(None)
>>> dom.appendChild(dom.createElement('foo'))
<Element Node at 134866000: Name = 'foo' with 0 attributes and 0
children>
>>> dom.documentElement.setAttribute('name', 'bar')
>>> dom.documentElement.setAttribute('spam', 'eggs')
>>> clone=dom.documentElement.cloneNode(deep=0)
>>> clone
<Element Node at 135075928: Name = 'foo' with 1 attributes and 0
children>
>>> dom.documentElement
<Element Node at 134866000: Name = 'foo' with 2 attributes and 0
children>
>>> clone.attributes
<NamedNodeMap at 135078128: {('', ''): <Attribute Node at 135078696:
Name = "name", Value = "bar">}>
>>> dom.documentElement.attributes
<NamedNodeMap at 134865912: {'spam': <Attribute Node at 135060184: Name
= "spam", Value = "eggs">, 'name': <Attribute Node at 135066776: Name =
"name", Value = "bar">}>


For detailed info, follow this link:
http://sourceforge.net/bugs/?func=detailbug&bug_id=125043&group_id=6473