I've got a method that gets passed in a document object. When I call it the
first time, the getLength call returns 4. I remove a node based on some
criteria. Later on, this function gets called again and the same document
is passed in. This second time, the getLength call *also* returns 4
(instead of 3 like I would expect). However, node.item[3] is now null. I
haven't traced it through the Xerces calls, but it looks like removeChild is
supposed to call changed() which flags it to update on the getLength()
call...is there something I'm missing?
---------------------------------------------------------------
The sample code is as follows:
NodeList nodelist = document.getChildNodes();
i = nodelist.getLength();
// Loop through all root child nodes of the document.
for (int j = 0; j < i; j++) {
Node node = nodelist.item(j);
if(j == 1) {
node.getParentNode().removeChild(node);
i--;
j--;
}
}
---------------------------------------------------------------
- Sean T.