public static String prettyPrint()

in src/main/java/org/apache/sling/commons/log/logback/internal/util/XmlUtil.java [38:58]


    public static String prettyPrint(InputSource is) {
        try {
            Transformer transformer = TransformerFactory.newInstance().newTransformer();
            transformer.setOutputProperty(OutputKeys.INDENT, "yes");
            transformer.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", "2");
            // initialize StreamResult with File object to save to file
            StreamResult result = new StreamResult(new StringWriter());
            Source source = new SAXSource(is);
            transformer.transform(source, result);
            return result.getWriter().toString();
        } catch (Exception e) {
            // Catch generic error as panel should still work if xml apis are
            // not
            // resolved
            log.warn("Error occurred while transforming xml", e);
        } finally {
            Util.close(is);
        }

        return "Source not found";
    }