Hi Anirudha,
If you want to delete a node
you should be at a parent level(parent node) to do it :
Ex:
if according to your condition "nd" is the node to be deleted then use the statement
nd.getParentNode().removeChild(nd);
Where nd is a "Node"
Regards
Balaji Pattabhiraman