Here you can find the source of createTransformerHandler(int indent)
private static synchronized TransformerHandler createTransformerHandler(int indent) throws SAXException
//package com.java2s; /***************************************************************************** * Copyright (c) 2006-2013, Cloudsmith Inc. * The code, documentation and other materials contained herein have been * licensed under the Eclipse Public License - v 1.0 by the copyright holder * listed above, as the Initial Contributor under such license. The text of * such license is available at www.eclipse.org. *****************************************************************************/ import javax.xml.transform.TransformerConfigurationException; import javax.xml.transform.TransformerFactory; import javax.xml.transform.sax.SAXTransformerFactory; import javax.xml.transform.sax.TransformerHandler; import org.xml.sax.SAXException; public class Main { private static SAXTransformerFactory saxTransformerFactory; private static synchronized TransformerHandler createTransformerHandler(int indent) throws SAXException { if (saxTransformerFactory == null) { TransformerFactory tf = TransformerFactory.newInstance(); if (!tf.getFeature(SAXTransformerFactory.FEATURE)) throw new SAXException("The TransformerFactory is not a SAXTransformerFactory"); //$NON-NLS-1$ saxTransformerFactory = (SAXTransformerFactory) tf; }/*from ww w . j ava2s . c om*/ try { saxTransformerFactory.setAttribute("indent-number", Integer.toString(indent)); //$NON-NLS-1$ } catch (IllegalArgumentException e) { // This transformer doesn't support ident-number. We dont' consider // that an error } try { return saxTransformerFactory.newTransformerHandler(); } catch (TransformerConfigurationException e) { throw new SAXException(e.getMessage()); } } }