Re: [問題] XML Document轉String

看板java作者 (淺水中)時間17年前 (2006/12/17 12:42), 編輯推噓0(000)
留言0則, 0人參與, 最新討論串2/3 (看更多)
※ 引述《montreal (╮(╯3╰)╭)》之銘言: : 請問各位 : 當用JDOM實現XML,產生Document類別後 : 如何將之轉為String,又如何轉回Document? : (像是XOM的Document.toXML()傳回String功能) : 謝謝 它文件上面不就有有寫 要用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 看完之後你應該就會知道怎麼做 -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 140.123.105.36
文章代碼(AID): #15XCgWYH (java)
文章代碼(AID): #15XCgWYH (java)