Hassanur,
one thing you have to bear in mind is that when inserting/deleting in any DOM parser, the index values will change, so if you're doing this in a FOR loop, and you do an insert and on the next iteration you delete, you're pretty much not doing anything, not to mention if you do a delete, you'll get an out of bounds error when trying to reference what you thought was your last node.
that said, I don't know the specifics about JDOM, but if you do:
documentElement.selectNodes ("names/name")
you'll get a reference to all the names node, now if you do
myNodes = documentElement.selectNodes ("names/name[first='Hassanur']")
you'll get a reference to all the name nodes whos first text = 'Hassanur'
then you get the first one by doing myNodes.item(0)
Hope this helps, though I'm not sure if it answers your question
thanks
|