Remove XML Node using java parser
Alternative DOM Approach Alternatively, instead of doing a brute force traversal of the XML document you could use the XPath capabilities in the JDK to find the “B” element with value “13” and then remove it from its parent: import java.io.File; import javax.xml.parsers.*; import javax.xml.transform.*; import javax.xml.transform.dom.DOMSource; import javax.xml.transform.stream.StreamResult; import javax.xml.xpath.*; import org.w3c.dom.*; public class … Read more