src/main/java/com/rockagen/commons/util/XmlUtil.java
public static String formatPretty(String xmlStr, String enc,
                                      boolean isSuppressDeclaration) {

        if (CommUtil.isBlank(xmlStr))
            return xmlStr;

        if (enc == null)
            enc = ENCODING;

        OutputFormat formater = OutputFormat.createPrettyPrint();
        formater.setEncoding(enc);
        formater.setSuppressDeclaration(isSuppressDeclaration);
        return format(xmlStr, formater);
    }
public static String formatPretty(String xmlStr, String enc,
                                      boolean isSuppressDeclaration) {

        if (CommUtil.isBlank(xmlStr))
            return xmlStr;

        if (enc == null)
            enc = ENCODING;

        OutputFormat formater = OutputFormat.createPrettyPrint();
        formater.setEncoding(enc);
        formater.setSuppressDeclaration(isSuppressDeclaration);
        return format(xmlStr, formater);
    }
public static String formatPretty ( String xmlStr , String enc , boolean isSuppressDeclaration ) { if ( CommUtil . isBlank ( xmlStr ) ) return xmlStr ; if ( enc == null ) enc = ENCODING ; OutputFormat formater = OutputFormat . createPrettyPrint ( ) ; formater . setEncoding ( enc ) ; formater . setSuppressDeclaration ( isSuppressDeclaration ) ; return format ( xmlStr , formater ) ; }
Format xml {@link OutputFormat#createPrettyPrint()}

@param xmlStr                xml String
@param enc                   encoding
@param isSuppressDeclaration set supperss declaration
@return pretty String
Format xml { @link OutputFormat#createPrettyPrint () }