src/main/java/eu/europena/research/XmlUtil.java
/**
     * Converts a dom to a String
     * 
     * @param dom
     *            dom to convert
     * @param outputProperties
     *            the properties for the String representation of the XML
     * @return the dom as a String
     */
Converts a dom to a String

@param dom
dom to convert
@param outputProperties
the properties for the String representation of the XML
@return the dom as a String
Converts a dom to a String @param dom dom to convert @param outputProperties the properties for the String representation of the XML @return the dom as a String
public static String writeDomToString(Document dom, Properties outputProperties) {
        try {
            StringWriter ret = new StringWriter();
            TransformerFactory transFact = TransformerFactory.newInstance();
            Transformer transformer = transFact.newTransformer();
            if (outputProperties != null) transformer.setOutputProperties(outputProperties);
            DOMSource source = new DOMSource(dom);
            StreamResult result = new StreamResult(ret);
            transformer.transform(source, result);
            return ret.toString();
        } catch (Exception e) {
            throw new RuntimeException("Could not write dom to string!", e);
        }
    }
public static String writeDomToString ( Document dom , Properties outputProperties ) { try { StringWriter ret = new StringWriter ( ) ; TransformerFactory transFact = TransformerFactory . newInstance ( ) ; Transformer transformer = transFact . newTransformer ( ) ; if ( outputProperties != null ) transformer . setOutputProperties ( outputProperties ) ; DOMSource source = new DOMSource ( dom ) ; StreamResult result = new StreamResult ( ret ) ; transformer . transform ( source , result ) ; return ret . toString ( ) ; } catch ( Exception e ) { throw new RuntimeException ( "Could not write dom to string!" , e ) ; } }
Converts a dom to a String
Converts a dom to a String
// transFact.setAttribute("indent-number", 2);