RAAAAM
RAAAAM

Reputation: 3380

How to remove an element using SAX parser

Thanks for previous replies,

I am new to parsing concept using java, can anyone guide me how to modify the xml using saxparser. i searched long time to delete the tag but i dont know how to delete. pls guide me

Upvotes: 0

Views: 3554

Answers (1)

Chris
Chris

Reputation: 863

You can remove an element using this :

SAXReader reader = new SAXReader();
reader.setEncoding(CharEncoding.UTF_8);
Document customXmlDocument = reader.read(inputStream);
// Get the element you want to remove and then pass it to the remove method as so
customXmlDocument.remove(Element)

Upvotes: 1

Related Questions