common_helper/src/main/java/com/xiongyingqi/util/xml/TransformerUtils.java
public static void enableIndenting(Transformer transformer, int indentAmount) {
        Assert.notNull(transformer, "Transformer must not be null");
        Assert.isTrue(indentAmount > -1, "The indent amount cannot be less than zero : got " + indentAmount);
        transformer.setOutputProperty(OutputKeys.INDENT, "yes");
        try {
            // Xalan-specific, but this is the most common XSLT engine in any case
            transformer.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", String.valueOf(indentAmount));
        } catch (IllegalArgumentException ignored) {
        }
    }
public static void enableIndenting(Transformer transformer, int indentAmount) {
        Assert.notNull(transformer, "Transformer must not be null");
        Assert.isTrue(indentAmount > -1, "The indent amount cannot be less than zero : got " + indentAmount);
        transformer.setOutputProperty(OutputKeys.INDENT, "yes");
        try {
            // Xalan-specific, but this is the most common XSLT engine in any case
            transformer.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", String.valueOf(indentAmount));
        } catch (IllegalArgumentException ignored) {
        }
    }
public static void enableIndenting ( Transformer transformer , int indentAmount ) { Assert . notNull ( transformer , "Transformer must not be null" ) ; Assert . isTrue ( indentAmount > - 1 , "The indent amount cannot be less than zero : got " + indentAmount ) ; transformer . setOutputProperty ( OutputKeys . INDENT , "yes" ) ; try { // Xalan-specific, but this is the most common XSLT engine in any case transformer . setOutputProperty ( "{http://xml.apache.org/xslt}indent-amount" , String . valueOf ( indentAmount ) ) ; } catch ( IllegalArgumentException ignored ) { } }
Enable indenting for the supplied {@link javax.xml.transform.Transformer}. <p>If the underlying XSLT engine is
Xalan, then the special output key {@code indent-amount} will be also be set to a value of {@link
#DEFAULT_INDENT_AMOUNT} characters.

@param transformer  the target transformer
@param indentAmount the size of the indent (2 characters, 3 characters, etc.)
@see javax.xml.transform.Transformer#setOutputProperty(String, String)
@see javax.xml.transform.OutputKeys#INDENT
Enable indenting for the supplied { @link javax . xml . transform . Transformer } . <p > If the underlying XSLT engine is Xalan then the special output key { @code indent - amount } will be also be set to a value of { @link #DEFAULT_INDENT_AMOUNT } characters .