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

Uche Ogbuji uche.ogbuji@fourthought.com
Wed, 14 Feb 2001 07:22:56 -0700


> 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
> setNamedItemNS.
> 
> If someone could provide a fix or workaround, I would appreciate it.

I think Jeremey fixed this in 4Suite, and we'll be checking this into PyXML.  
Hopefully, based on all the problems reported lately, there will soon be a 
PyXML 0.6.4.

After today's 4Suite release (yes, we're in final packaging.  Hooray!) we'll 
be removing 4DOM from the package so it lives completely in PyXML.  This 
should accelerate maintenance.


-- 
Uche Ogbuji                               Principal Consultant
uche.ogbuji@fourthought.com               +1 303 583 9900 x 101
Fourthought, Inc.                         http://Fourthought.com 
4735 East Walnut St, Ste. C, Boulder, CO 80301-2537, USA
Software-engineering, knowledge-management, XML, CORBA, Linux, Python