从包含非法字符的XML描述标记解析HTML

从包含非法字符的XML描述标记解析HTML,html,xml,parsing,character,qml,Html,Xml,Parsing,Character,Qml,我使用一个QML XmlListModel来显示有效的XML提要。但由于下面的描述标记中包含HTML,因此格式设置已关闭 <description>&lt;p&gt;&lt;a href="http://news.yahoo.com/north-korea-issues-military-threats-founders-birthday-000221193.html"&gt;&lt;img src="http://l1.yimg.com/bt

我使用一个QML XmlListModel来显示有效的XML提要。但由于下面的描述标记中包含HTML,因此格式设置已关闭

<description>&lt;p&gt;&lt;a href="http://news.yahoo.com/north-korea-issues-military-threats-founders-birthday-000221193.html"&gt;&lt;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" /&gt;&lt;/a&gt;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&amp;#039;s
    birth, stoking tension on the peninsula with a new &amp;quot;ultimatum&amp;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&amp;#039;s latest nuclear test in February. ...&lt;/p&gt;&lt;br clear="all"/&gt;
</description>

尝试用CDATA标记包装HTML和长URL,XML将以这种方式删除非法字符:

<description><![CDATA[

&lt;p&gt;&lt;a href="http://news.yahoo.com/north-korea-issues-military-threats-founders-birthday-000221193.html"&gt;&lt;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" /&gt;&lt;/a&gt;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&amp;#039;s
    birth, stoking tension on the peninsula with a new &amp;quot;ultimatum&amp;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&amp;#039;s latest nuclear test in February. ...&lt;/p&gt;&lt;br clear="all"/&gt;

]]></description>

那么,您应该能够知道任何脚本正在拉动HTML以将其包装在CDATA标记中。看看这个,看看你是否能把它注入你的代码中。。。希望这能对你有所帮助,否则我需要更多地了解你使用的方法
<description><![CDATA[

&lt;p&gt;&lt;a href="http://news.yahoo.com/north-korea-issues-military-threats-founders-birthday-000221193.html"&gt;&lt;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" /&gt;&lt;/a&gt;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&amp;#039;s
    birth, stoking tension on the peninsula with a new &amp;quot;ultimatum&amp;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&amp;#039;s latest nuclear test in February. ...&lt;/p&gt;&lt;br clear="all"/&gt;

]]></description>