1
使用DOM內容我有一個這樣的XML:獲取HTML從XML樹中的Android
<root>
<item>
<content type="HTML">
<![CDATA[<html>
<head></head>
<body>something goes there</body>
</html>]]>
</content>
</item>
<item>
<content type="Text">
Something goes there
</content>
</item>
</root>
隨着內容是文本類型,我可以node.getTextContent()得到。
問題是我想從Xml樹中獲取所有的Html內容。所以我想要得到的結果是字符串:
"<html><head></head><body>some thing goes there</body></html>"
我該如何在Android中使用Document(DOM)?
注意:因爲我必須編輯一些XML內容,所以我不能使用SAX。
謝謝。我已經閱讀了這些API。但解決我的問題並不容易,因爲我不僅需要節點名稱和值,還需要'<,>'標籤。所以,問題是如何? – R4j 2012-04-19 05:16:42