W3C home > Mailing lists > Public > html-tidy@w3.org > July to September 2000

problem with Node.removeChild()

From: X. Shen <xshen@dfki.uni-kl.de>
Date: Mon, 31 Jul 2000 06:26:57 -0400 (EDT)
Message-ID: <39855497.6D58F8BF@dfki.uni-kl.de>
To: html-tidy@w3.org

as a green beginner, I just encountered a problem concerning the method
removeChild() specified in the class Node. Your kind help and
instruction are highly appreciated.
In order to remove the processing instruction nodes in the DOM generated
by Tidy.parseDOM(), which are often malformatted, the following lines
are written:
... ...
    Node n;
... ...
    NodeList list = n.getChildNodes();
    int i = 0;
    while (i < list.getLength()){
        Node node = list.item(i);
        if (node.getNodeType() == Node.PROCESSING_INSTRUCTION_NODE){
      i ++;
... ...
There comes sometimes a run-time exception:
"org.w3c.tidy.DOMExceptionImpl: refChild not found.", yet the node to be
removed does exist. How could that happen?

Thanks a lot for your time!

Xianghua Shen
Received on Tuesday, 1 August 2000 23:21:06 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 21:38:48 UTC