The same problem was detected. Although the question was asked a long time ago, I would like to share a solution:
The XMLConfiguration class has a protected method called createTransformed. It must be expanded and set to the correct indentation configuration .
public class ExtendedXMLConfiguration extends XMLConfiguration { public ExtendedXMLConfiguration(File file) throws ConfigurationException { super(file); } @Override protected Transformer createTransformer() throws TransformerException { Transformer transformer = super.createTransformer(); transformer.setOutputProperty(OutputKeys.INDENT, "yes"); transformer.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", "4"); return transformer; } }
source share