[XML-SIG] 4DOM: Problem cloning attributes

Jeremy J Kloth jeremy.kloth@fourthought.com
Wed, 19 Jul 2000 09:51:51 -0600


> Hello,
>
> [I'm not sure a previous mail reporting a weird problem with importNode
has made
> it to the xml-sig list, since I have not received it myself. If so, this
is a
> narrowing of this problem]
>
> I'm using 4Dom from the XML-SIG CVS repository.
>
> I think I've found an issue on namespace when cloning attribute nodes. I
have a
> fix, but am not sure that it will work in all cases.
>
> The problem is the following :
>
> ----------------------8<-------------------------------------------
> from xml.dom.ext.reader import Sax2
>
> tree = """<document><child foo='foo1' bar='bar1'/></document>"""
>
> if __name__ == '__main__':
>     doc = Sax2.FromXml(tree,None,0,1)
>
>     child = doc.documentElement.firstChild
>     print child
>     clone = child.cloneNode(1)
>     print clone
> ----------------------8<-------------------------------------------
>
> The output of the script is :
> [alf@leo alf]$ python domimport.py
> <Element Node at 135922784: Name = 'child' with 2 attributes and 0
children>
> <Element Node at 135910896: Name = 'child' with 1 attributes and 0
> children>
>
> I've lost an attribute during cloning.
> [... snip ...]
> Alexandre Fayolle

The problem that you encountered has been fixed in our upcoming release (a
day or two). We will be updating the CVS repository at that time.  Thank you
for pointing that out to us.  It slipped through our test net. However, we
have done a complete re-write of the clone and import sections, so the fix
is not usable, but very much appriciated.

--
Jeremy Kloth                        Consultant
jeremy.kloth@fourthought.com        (303)583-9900 x 102
Fourthought, Inc.                   http://www.fourthought.com
Software-engineering, knowledge-management, XML, CORBA, Linux, Python