Categories
Java

Setting Transformer properties

Just a small reminder on how to tell a Java Transformer object what the output should look like.

Share

So you are going to output an XML Document to a file using this canonical method. But how do you tell the Transformer object how the output should look like?

You use OutputKeys, that’s how.

For example:
transformer.setOutputProperty(OutputKeys.INDENT,"yes");

Share

Leave a Reply

Your email address will not be published. Required fields are marked *

 

Share