public abstract class TransformerUtils
extends java.lang.Object
Transformers
and the javax.xml.transform
package in general.Modifier and Type | Field and Description |
---|---|
static int |
DEFAULT_INDENT_AMOUNT
The indent amount of characters if
indenting is enabled . |
Constructor and Description |
---|
TransformerUtils() |
Modifier and Type | Method and Description |
---|---|
static void |
disableIndenting(javax.xml.transform.Transformer transformer)
Disable indenting for the supplied
Transformer . |
static void |
enableIndenting(javax.xml.transform.Transformer transformer)
Enable indenting for the supplied
Transformer . |
static void |
enableIndenting(javax.xml.transform.Transformer transformer,
int indentAmount)
Enable indenting for the supplied
Transformer . |
public static final int DEFAULT_INDENT_AMOUNT
indenting is enabled
.
Defaults to "2".
public static void enableIndenting(javax.xml.transform.Transformer transformer)
Transformer
.
If the underlying XSLT engine is Xalan, then the special output key indent-amount
will be also be set to a value of DEFAULT_INDENT_AMOUNT
characters.
transformer
- the target transformerTransformer.setOutputProperty(String, String)
,
OutputKeys.INDENT
public static void enableIndenting(javax.xml.transform.Transformer transformer, int indentAmount)
Transformer
.
If the underlying XSLT engine is Xalan, then the special output key indent-amount
will be also be set to a value of DEFAULT_INDENT_AMOUNT
characters.
transformer
- the target transformerindentAmount
- the size of the indent (2 characters, 3 characters, etc)Transformer.setOutputProperty(String, String)
,
OutputKeys.INDENT
public static void disableIndenting(javax.xml.transform.Transformer transformer)
Transformer
.transformer
- the target transformerOutputKeys.INDENT