How to convert org.jdom.Document to String
How do I to convert开发者_开发百科 an org.jdom.Document to a String in Java?
new XMLOutputter().outputString(doc);
I got the answer myself
XMLOutputter xmOut = new XMLOutputter();
System.out.println("----" + xmOut.outputString(doc));
You can as well do like this with StringWriter
StringWriter writer = new StringWriter();
new XMLOutputter().output(doc, writer);
System.out.println(writer.toString());
精彩评论