Reputation: 2358
I'm modifying an xml file and I'm using the following code to export it. But I do not like how the Transformer is formatting my xml. Can I somehow keep the xml the way it was before ?
TransformerFactory transformerFactory = TransformerFactory.newInstance();
Transformer transformer = transformerFactory.newTransformer();
//transformer.setOutputProperty(OutputKeys.INDENT, "yes");
DOMSource source = new DOMSource(document);
StreamResult result = new StreamResult(moduleFile);
transformer.transform(source, result);
Upvotes: 0
Views: 750
Reputation: 22524
I very much doubt that a DOM document has any "formatting", as it is an abstract representation of the XML data. The most that you can do is play with some whitespace, comments, and such. Some pointers.
Upvotes: 1