开发者

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());
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜