[XML-SIG] [ pyxml-Bugs-414263 ] pDomlette: appending empty DocFrag

noreply@sourceforge.net noreply@sourceforge.net
Fri, 06 Apr 2001 03:34:40 -0700


Bugs item #414263, was updated on 2001-04-06 03:34
You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=106473&aid=414263&group_id=6473

Category: 4Suite
Group: None
Status: Open
Priority: 5
Submitted By: Alexandre Fayolle (afayolle)
Assigned to: Nobody/Anonymous (nobody)
Summary: pDomlette: appending empty DocFrag

Initial Comment:
When using appendChild with an empty DocumentFragment,
the fragment is appended to the node. Same thing with
insertBefore.

Demo code :

>>> from Ft.Lib.pDomlette import PyExpatReader
>>> d =
PyExpatReader().fromString('<doc><whatever/></doc>')
>>> df = d.createDocumentFragment()
>>> d.documentElement.appendChild(df)
<Domlette DocumentFragment Node at 8145a20 with 0
children>
>>> d.documentElement.childNodes # We expect to see
only the <whatever> child here
[<Domlette Element Node at 813ec78: name='whatever'
with 0 attributes and 0 children>, <Domlette
DocumentFragment Node at 8145a20 with 0 children>]


The problem is that the new node is tested both for
DocumentFragmentitude and non emptyness in the code,
and the the else clause catches the empty doc frag and
does the default processing with it.

Attached to this report is a patch to pDomlette.py that
fixes the problem. It was generated on top of the other
patch I submitted this week, but they do not overlap,
so this should not be problem. 

Cheers

Alexandre Fayolle

----------------------------------------------------------------------

You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=106473&aid=414263&group_id=6473