> Am I missing something in the DOM spec or the Xerces API? Yes = NodeLists are live. That means if you created a NodeList of children of a node, if you delete a child, it gets removed from the NodeList, too. Original NodeList child 0 : child 1 : child 2 : Same NodeList after .removeChild(): child 0 : child 1 : One way to work around this is to iteraet backward over the nodelist. If you remove the last Node, the other nodes don't change place like if you delete the first. Brian > -----Original Message----- > From: Kevin Olson [mailto:kevolson@visi.com] > Sent: Friday, February 04, 2000 1:55 PM > To: general@xml.apache.org > Subject: Question about removeChild > > > Hello all, > > Using Xerces 1.0.1 and given the following doc... > > > > > > > > > I am iterating through a NodeList trying to delete the > element and > the element. I reach the element and do the following > (where 'n' is the current node in the NodeList). > > Node parent = n.getParentNode(); > parent.removeChild(n); > > And the node gets blasted like I would expect. I > would also expect > to be able to delete the element in the next iteration of the > NodeList. What happens, however, is that the next node in > the list is the > node. > > It works if I try to delete the and node. > Just not two > consecutive nodes with the same parent. I can show more of > the code if > that would help. > > Am I missing something in the DOM spec or the Xerces API? > > Thanks, > Kevin > > >