Using: javax.xml
and org.w3c
:
public void removeNodeFromXML(File xmlfile_, String uuid)
{
DocumentBuilderFactory factory = Docume
You can use XPath to select specific elements/attributes. Just search the web for Tutorials. Here is good one. You should also read the Java-Doc for java.xml.xpath, which includes short examples.
The XPath-Expression for your XML-File is: /server[@ID='xxxx']
You can use:
Element element = doc.getElementById("1236");
element.getParentNode().removeChild(element);
This should give you the element with ID "1236". You then get the parent node for the element and remove the element by passing the element with ID "1236" to removeChild.
See here for a full example.
Hope this helps.