0
我正在使用QML XmlListModel來顯示可用的XML源。由於HTML包含在下面的描述標記中,因此格式設置已關閉。從XML描述標記解析非法字符的HTML
<description><p><a href="http://news.yahoo.com/north-korea-issues-military-threats-founders-birthday-000221193.html"><img src="http://l1.yimg.com/bt/api/res/1.2/aSYzNa8DFZPW0FCALm20Yw--/YXBwaWQ9eW5ld3M7Zmk9ZmlsbDtoPTg2O3E9ODU7dz0xMzA-/http://media.zenfs.com/en_us/News/Reuters/2013-04-15T141115Z_1_CBRE93E0OEY00_RTROPTP_2_KOREA-NORTH.JPG"
width="130" height="86" alt="North Korean soldiers, workers and students place flowers before statues of Kim Il-sung and Kim Jong-il at Mansudae in Pyongyang" align="left" title="North Korean soldiers, workers and students place flowers before statues
of Kim Il-sung and Kim Jong-il at Mansudae in Pyongyang" border="0" /></a>By Ju-min Park and Jack Kim SEOUL (Reuters) - North Korea made new threats of military action on Monday as the reclusive nation celebrated the anniversary of its founder&#039;s
birth, stoking tension on the peninsula with a new &quot;ultimatum&quot; to South Korea in the stand-off over its nuclear program. The latest statement from Pyongyang followed threats of nuclear attacks on the United States, South Korea and Japan,
after new U.N. sanctions were imposed in response to the North&#039;s latest nuclear test in February. ...</p><br clear="all"/>
</description>
我想既然喜歡<
和>
字符不會在XML允許HTML成爲自字符被替換。
我使用下面的模型,除了一些問題發生時,描述包含HTML文本被改變時發生。
XmlListModel {
id: model
property string feedUrl: rss.activeFeed
source: "http://" + feedUrl
query: "/rss/channel/item"
property ListModel temp
property int action
XmlRole { name: "title"; query: "title/string()" }
XmlRole { name: "link"; query: "link/string()"}
XmlRole { name: "description"; query: "description/string()" }
}
那麼,你應該能夠告訴任何腳本是拉動HTML把它包在CDATA標籤。檢查tyhis了,看看你不能注入這個代碼在你的代碼... http://api.jquery.com/wrap/希望這將有助於你,否則我將需要更多地瞭解你使用的是什麼方法 –