[XML-SIG] 4DOM bugs

Martin v. Loewis martin@loewis.home.cs.tu-berlin.de
Sun, 8 Oct 2000 10:33:35 +0200

While porting PyXML's test_dom to 4DOM, I noticed a number of
problems, which I believe are bugs in 4DOM. Consider

from xml.dom import implementation

doc = implementation.createDocument(None,None,None)

n1 = doc.createElement('n1') ; n2 = doc.createElement('n2')
pi = doc.createProcessingInstruction("Processing", "Instruction")

#doc.appendChild(n1) # fails, but shouldn't
doc.replaceChild(n2, n1)
doc.replaceChild(pi, n2)
print doc.documentElement

The line "doc.appendChild(n1)" raises a hierarchy exception, as n1 is
already in the tree. However, this is incorrect: it should first
remove n1, then reinsert it.

The second fragment does not cause an exception. However, in the end,
the "documentElement" of the document is a processing
instruction. That is very strange - it should always be an element.

I've been using the 4DOM version that is currently in the PyXML CVS.