将dom4j格式化为标准的xml字符串

StringWriter writer = new StringWriter();

OutputFormat format = OutputFormat.createPrettyPrint();

format.setEncoding("gb2312");

XMLWriter xmlwriter = new XMLWriter( writer, format );

try {

xmlwriter.write(document);

} catch (Exception e) {

e.printStackTrace();

}

return writer.toString();

posted on 2016-02-23 17:28  厚积!!  阅读(1425)  评论(0编辑  收藏  举报

导航