public static Transformer newTransformer() throws TransformerConfigurationException { return newTransformerFactory().newTransformer(); }
public static Transformer newTransformer(int indent) throws TransformerConfigurationException { TransformerFactory factory = newTransformerFactory(); factory.setAttribute("indent-number", Integer.valueOf(indent)); Transformer transformer = factory.newTransformer(); transformer.setOutputProperty(OutputKeys.INDENT, "yes"); return transformer; } }