i have the following xml :
<table1>
<row0>
<column1>String</column1>
<column2>int</column2>
</row0>
<row1>
<column1>aa</column1>
<column2>65432</column2>
</row1>
<row2>
<column1>ww</column1>
<column2>1111</column2>
</row2>
<row3>
<column1>fff</column1>
<column2>333</column2>
</row3>
<row4>
<column1>jj</column1>
<column2>2</column2>
</row4>
</table1>
and i want to delete the node row3 and its elements. I am writing that XML file in java.how to do that? i saw this code in another post but couldn't understand it
public static void main(String[] args) throws Exception {
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
Document document = dbf.newDocumentBuilder().parse(new File("input.xml"));
XPathFactory xpf = XPathFactory.newInstance();
XPath xpath = xpf.newXPath();
XPathExpression expression = xpath.compile("//A/B[C/E/text()=13]");
Node b13Node = (Node) expression.evaluate(document, XPathConstants.NODE);
b13Node.getParentNode().removeChild(b13Node);
TransformerFactory tf = TransformerFactory.newInstance();
Transformer t = tf.newTransformer();
t.transform(new DOMSource(document), new StreamResult(System.out));
}