XML : XML Node is not being removed from XML file

I am using org.w3c.dom xml elements.

I get to a point where this line is being called (saw it gets there when debugged the code):

  node.getParentNode().removeChile(node);    

However, the node remains at the file and it's not being updated at all.

Just for testing, I tried also doing:

  Element root = doc.getDocumentElement();  root.removeChild(node);  node.getParentNode().removeChile(node);    

And then I got an exception on the 3rd line of a null pointer exception, but the node still remains in the file itself, and I can call the deletion action again and the node is found in the file.

Is there something else needed to be done in order to delete the node?

No comments:

Post a Comment