Here you can find the source of createTransformer()
private static Transformer createTransformer()
//package com.java2s; //License from project: Open Source License import javax.xml.transform.*; public class Main { private static final TransformerFactory m_xformFactory = TransformerFactory.newInstance(); /**//www. j a va2 s . co m * Create a {@link Transformer} just the way we like it. * * @return Returns a new {@link Transformer}. */ private static Transformer createTransformer() { final Transformer xform; try { xform = m_xformFactory.newTransformer(); } catch (TransformerConfigurationException e) { throw new IllegalStateException(e); } xform.setOutputProperty(OutputKeys.INDENT, "yes"); xform.setOutputProperty("{http://xml.apache.org/xalan}indent-amount", "2"); xform.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "yes"); return xform; } }