You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-dev@xerces.apache.org by Anthony Milan <an...@voila.fr> on 2000/08/09 12:21:50 UTC

bug report

Hi !

I think I find a bug :

I use :
Xerces 1.1.3
JDK 1.2.2

When you use the replaceChild(Node, Node) method and the node who calls 
this method is the document node, the document element is not update. In

fact after I call the getDocumentElement() method and it returns the old

document element.

My code :

Node parent = oldNode.getParentNode();
if (parent.getNodeType() == Node.DOCUMENT_NODE) {
  System.out.println(((Document) parent).getDocumentElement());
}
parent.replaceChild(newNode, oldNode);
if (parent.getNodeType() == Node.DOCUMENT_NODE) {
  System.out.println(((Document) parent).getDocumentElement());
}

The display is the same wheras is must be different, and I am sure that 
newNode and oldNode are different of course.

I think you should "redefine" the method replaceChild(Node, Node) in the
 DocumentImpl class and upadte the field docElement.

Anthony Milan