[XML-SIG] bug in xml.dom.Document.importNode?

Michael Dyck MichaelDyck@home.com
Wed, 14 Feb 2001 00:42:08 -0800

When I "import" a node from one document into another, it loses attributes.

To reproduce:
    from xml.dom import Document
    from xml.dom.ext.reader.Sax import FromXml
    from xml.dom.ext import PrettyPrint

    doc1 = FromXml("<foo a1='1' a2='2' a3='3'/>")
    original_node = doc1.documentElement
    PrettyPrint( original_node )

    doc2 = Document.Document( None )
    imported_node = doc2.importNode( original_node, deep=1 )
    PrettyPrint( imported_node )
prints out:
    <foo a2='2' a3='3' a1='1'/>
    <foo a1='1'/>

This happened with Python 2.0, and also happens with PyXML 0.6.3.
(I'm on Windows 95, if that makes a difference.)

I think the problem is somewhere near Element.__setstate__'s call to

If someone could provide a fix or workaround, I would appreciate it.

-Michael Dyck