Originally posted by Valentin Crettaz: Have you tried org.jdom.Document.toString() ?
Thanks, Valentin. toString does not work, only gives you root element and ns. I figured it out, the follwoing will work: StringWriter writer = new StringWriter(); TransformerFactory tf = TransformerFactory.newInstance(); Transformer tran = tf.newTransformer(); Source src = new DOMSource(doc); Result res = new StreamResult(writer); tran.transform(src, res); String xml = writer.toString();
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com