Here is my code.
Expand|Select|Wrap|Line Numbers
- DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
- DocumentBuilder builder = dbf.newDocumentBuilder();
- Document document = builder.newDocument();
- document = builder.parse(new InputSource(new StringReader(string)));
I tried it the following way as suggest by a website while googling,
Expand|Select|Wrap|Line Numbers
- NodeList nodelist = document.getElementsByTagName("name");
- Element e1 = (Element)nodeList.item(1);
- e1.getParentNode().removeChild(e1);
I simply dont know how to remove an element from the actual DOM document. Any ideas anyone?
Cheers for looking at it.