Here you can find the source of getTransformer()
private static Transformer getTransformer() throws TransformerException
//package com.java2s; //License from project: Open Source License import javax.xml.transform.OutputKeys; import javax.xml.transform.Transformer; import javax.xml.transform.TransformerException; import javax.xml.transform.TransformerFactory; public class Main { private static Transformer getTransformer() throws TransformerException { Transformer transformer = TransformerFactory.newInstance().newTransformer(); transformer.setOutputProperty(OutputKeys.INDENT, "yes"); transformer.setOutputProperty(OutputKeys.METHOD, "xml"); return transformer; }//from w w w .ja va2 s . c om }