I want to delete the child depending on the "name" attribute. Is there a way to do this ? i tried to do this with DOM but didnt work. Also, i can get the specific child node using XPath. But then again, how do i delete it from the xml ?
If you look in the API documentation for the Node interface of DOM, you surely will find a method which deletes, or perhaps removes, a Node. Just scan down the list of methods until you find it. You would use that method once you have a reference to the node.
If you are still stuck, post your code and let's discuss it.
Sharad Khanna
Greenhorn
Joined: Mar 19, 2010
Posts: 3
posted
0
You will need to parse the XML using either jdom or java.xpath libraries and delete the node.
reggie rui wrote:I have the following xml:
I want to delete the child depending on the "name" attribute. Is there a way to do this ? i tried to do this with DOM but didnt work. Also, i can get the specific child node using XPath. But then again, how do i delete it from the xml ?