public static void prettyPrintXML(final XMLReader xmlReader,
                                      final InputSource inputSource,
                                      final Writer writer) {
        try {
            final TransformerHandler handler = createTransformerHandler(new FatalErrorListener(), true);
            handler.setResult(new StreamResult(writer));
            xmlReader.setErrorHandler(new FatalErrorHandler());
            xmlReader.setContentHandler(handler);
            xmlReader.parse(inputSource);

        } catch (final TransformerConfigurationException
                | IOException
                | SAXException e) {
            throw new RuntimeException(e);
        }
    }
Convert a java type into a xml name E.g. XMLType = "xmlType", String =
"string", StringBIG = "StringBIG"
stroom-util/src/main/java/stroom/util/xml/XMLUtil.java