How do I to convert an org.jdom.Document to a String in Java?
Asked
Active
Viewed 2.7k times
3 Answers
15
I got the answer myself
XMLOutputter xmOut = new XMLOutputter();
System.out.println("----" + xmOut.outputString(doc));

Christophe Roussy
- 16,299
- 4
- 85
- 85

Aravind
- 2,188
- 4
- 24
- 28
0
You can as well do like this with StringWriter
StringWriter writer = new StringWriter();
new XMLOutputter().output(doc, writer);
System.out.println(writer.toString());

mwangox
- 389
- 5
- 4