public static Transformer setOutputProperties ( Transformer transformer , boolean omitXMLDeclaration , int indentAmount , String encoding ) { transformer . setOutputProperty ( OutputKeys . OMIT_XML_DECLARATION , omitXMLDeclaration ? "yes" : "no" ) ; // indentation if ( indentAmount > 0 ) { transformer . setOutputProperty ( OutputKeys . INDENT , "yes" ) ; transformer . setOutputProperty ( OUTPUT_KEY_INDENT_AMOUT , String . valueOf ( indentAmount ) ) ; } if ( ! StringUtil . isWhitespace ( encoding ) ) transformer . setOutputProperty ( OutputKeys . ENCODING , encoding . trim ( ) ) ; return transformer ; }
to set various output properties on given transformer .