我正在解析下面的xml文件:
<description>
<p>
<a href="http://news.yahoo.com/jessica-chastain-talks-princess-diana-biopic- 164102608.html">
<img src="http://l3.yimg.com/bt/api/res/1.2/zD3Iwxezk8JVGQwhow7y4Q--/YXBwaWQ9eW5ld3M7Zmk9ZmlsbDtoPTg2O3E9ODU7dz0xMzA-/http://media.zenfs.com/en_us/News/Reuters/2011-11-07T171906Z_01_BTRE7A61C3Y00_RTROPTP_2_FILM-US-JESSICACHASTAIN.JPG"
alt="photo"
align="left"
title="Actress Chastain poses for photographers as she arrives on the "Wilde Salome" red carpet at the 68th Venice Film Festival" border="0" />
</a>NEW YORK (TheWrap.com) - Jessica Chastain may not win Oscar gold this year, but it appears she will wear a crown.
</p>
<br clear="all"/>
</description>
我正在使用SAX解析器,并尝试获取img标签title属性中的数据。但是由于文本中的特殊字符“ Wild Salome”,我遇到了ExpatParser异常。
您能告诉我如何解决吗?
最佳答案
XML无效。属性值不应包含引号("
)。生成它的程序应将内部"
字符替换为"
。
如果将"
打印到网页,浏览器将在其位置自动显示"
字符。