Core/src/main/java/org/openestate/io/core/XmlUtils.java
public static void write(Document doc, Writer output, boolean prettyPrint) throws TransformerException {
        XmlUtils.clean(doc);
        Transformer transformer = TransformerFactory.newInstance().newTransformer();
        transformer.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "no");
        transformer.setOutputProperty(OutputKeys.METHOD, "xml");
        transformer.setOutputProperty(OutputKeys.ENCODING, "UTF-8");
        transformer.setOutputProperty(OutputKeys.STANDALONE, "yes");
        transformer.setOutputProperty(OutputKeys.INDENT, (prettyPrint) ? "yes" : "no");
        if (prettyPrint) {
            transformer.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", "2");
        }
        transformer.transform(new DOMSource(doc), new StreamResult(output));
    }
public static void write(Document doc, Writer output, boolean prettyPrint) throws TransformerException {
        XmlUtils.clean(doc);
        Transformer transformer = TransformerFactory.newInstance().newTransformer();
        transformer.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "no");
        transformer.setOutputProperty(OutputKeys.METHOD, "xml");
        transformer.setOutputProperty(OutputKeys.ENCODING, "UTF-8");
        transformer.setOutputProperty(OutputKeys.STANDALONE, "yes");
        transformer.setOutputProperty(OutputKeys.INDENT, (prettyPrint) ? "yes" : "no");
        if (prettyPrint) {
            transformer.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", "2");
        }
        transformer.transform(new DOMSource(doc), new StreamResult(output));
    }
Write a {@link Document} to a {@link Writer}.

@param doc         the document to write
@param output      the output, where the document is written to
@param prettyPrint if pretty printing is enabled for the generated XML code
@throws TransformerException if XML transformation failed