After you have created a Document object using a DOM parser you can modify it using the methods of the Document, Element and Node classes/interfaces. How you save it afterwards depends on the XML package you use, but I think all of them can do it.
I yam what I yam and that's all that I yam - the great philosopher Popeye. Tiny ad:
Gift giving made easy with the permaculture playing cards