Dom4j生成XML document to String

此前苦苦寻找的方法:

 

1 java.io.StringWriter out = new java.io.StringWriter();
2 XMLWriter xw = new XMLWriter (out, new OutputFormat (" ", true, "GB2312"));
3 xw.write(document);
4 String xmlstring = out.toString();
5 return xmlstring;
posted @ 2010-04-26 15:28  樱色布  阅读(2065)  评论(0编辑  收藏  举报