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

Uche Ogbuji uche.ogbuji@fourthought.com
Wed, 14 Feb 2001 16:01:54 -0700


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

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

This is another bug fixed in 4DOM CVS:

     from xml.dom import Document
     from xml.dom.ext.reader import PyExpat
     from xml.dom.ext import PrettyPrint
     reader = PyExpat.Reader()
     doc1 = reader.fromString("<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

<foo a1='1' a2='2' a3='3'/>

We're wrapping up the 4Suite release, which will have the fix, then we'll 
check in to PyXML CVS to propagate the fix there.


-- 
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