[XML-SIG] 4DOM: Weird importNode behaviour
Alexandre Fayolle
alexandre.fayolle@free.fr
Tue, 18 Jul 2000 17:19:11 +0200
Hello,
I've came accross a weird behaviour using importNode (I'm using the latest
version of xml package from the SIG CVS repository, with the patches I
mentionned in my previous mail) : when importing a node, I loose all attributes
but one. The following code exibits the behaviour :
-------------------8<------------------------------------------------------
from xml.dom.ext.reader import Sax2
from xml.dom.ext.Printer import PrintVisitor
tree1 = """<document></document>"""
tree2 = """<document><child foo='foo1' bar='bar1' baz='baz1'/></document>"""
if __name__ == '__main__':
doc1 = Sax2.FromXml(tree1,None,0,1)
doc2 = Sax2.FromXml(tree2,None,0,1)
child = doc2.documentElement.firstChild
doc1.documentElement.appendChild(doc1.importNode(child,1))
pv=PrintVisitor()
print pv.visitDocument(doc2)
print
print pv.visitDocument(doc1)
------------------------------8<-------------------------------------------
I'd expect to get twice the same line (and this line to be the same as tree2,
with the possible exception on the ordering of child's attributes), however,
what I get is :
[alf@leo alf]$ python domimport.py
<document><child baz='baz1' foo='foo1' bar='bar1'/></document>
<document><child bar='bar1'/></document>
Am I missing something ?
Thanks in advance for your help.
Alexandre Fayolle