天天看點

dom4j string轉為xml

​<code>​/**XML轉字元串 */​</code>​

​<code>​Document document = new SAXReader().read(new File("E:test.xml"));; ​</code>​

​<code>​String text = document.asXML(); ​</code>​

/**字元串轉XML */

String xmlStr = ****; 

​<code>​Document document = DocumentHelper.parseText(xmlStr); ​</code>​