Here you can find the source of createTransformer()
Parameter | Description |
---|---|
Exception | when error occurs |
public static Transformer createTransformer() throws Exception
//package com.java2s; import javax.xml.transform.OutputKeys; import javax.xml.transform.Transformer; import javax.xml.transform.TransformerFactory; public class Main { /**/*from w ww . java2 s. co m*/ * Creates a Transformer instance. * * @return the created Transformer * @throws Exception * when error occurs */ public static Transformer createTransformer() throws Exception { Transformer xmlTransformer = TransformerFactory.newInstance() .newTransformer(); xmlTransformer.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "yes"); xmlTransformer.setOutputProperty(OutputKeys.INDENT, "yes"); return xmlTransformer; } }