How to write an XML to file, with just a Parser instance?

Published: 31/01/2018
How to write an XML to file, with just a Parser instance?
Source: STACKOVERFLOW.COM

This is my Groovy code: // ... def xml = new XmlParser().parse(fileName) xml.each { e -> // some changes are being made to XML xml.append("test", "test me") } def writer = new FileWriter(newFileName) new XmlNodePrinter(new PrintWriter(writer)).print(xml) The code works, but the output XML has a lot of unnecessary white spaces. Looks like I'm doing something wrong with writing to file. ps.

Read more
Related news
Comment