看板 java 關於我們 聯絡資訊
※ 引述《calais007 (淺水中)》之銘言: : 它文件上面不就有有寫 : 要用API之前要先看使用說明阿 : 在Document class的文件說明上toString()這樣寫 : toString : public java.lang.String toString()This returns a String representation of the : Document, suitable for debugging. If the XML representation of the Document : is desired, XMLOutputter.outputString(Document) should be used. : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ : 例如 : XMLOutputter outtper = new XMLOutputter(); : String xml = outter.outputString(document); : 官方文件上有一章寫的 : Reading XML Documents with JDOM : 看完之後你應該就會知道怎麼做 補完: /* 把 xmlString 再變回 org.jdom.Document */ SAXBuilder saxBuilder = new SAXBuilder(false); Reader stringReader = new StringReader(xmlString); org.jdom.Document doc = saxBuilder.build(stringReader); -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 61.216.174.175