我正在解析下面的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异常。 能不能让我知道如何解决这个问题?
答案 0 :(得分:1)
XML无效。属性值不应包含引号("
)。生成它的程序应该用"
替换内部"
个字符。
如果您将"
打印到网页,浏览器会自动在其位置显示"
- 字符。