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;

你可能感兴趣的:(document)