【发布时间】:2015-03-01 07:31:50
【问题描述】:
我正在使用 Cocoapods 的 MWFeedParser 来解析新闻 RSS 提要。效果很好。
但是当新闻项目的描述包含 HTML(例如,用于视频嵌入)时,我不太知道如何处理它。提要网址为:DCI News Feed
以下是来自提要的 2 条新闻。第一个是不会给我带来麻烦的基本项目。第二个包含嵌入 YouTube 视频的 HTML。它使描述属性显示原始文本。我想识别 HTML 而不显示它,但要显示 HTML 后面的实际描述(在这种情况下)。
没有 HTML:
<item>
<title>12 drum corps who celebrated Christmas in July</title>
<description>
It�s the time of year for festive lights, merry music, and great shopping deals in stores and online. As you get set to celebrate another holiday season, you might be surprised to find that sounds of the Christmas season have long been hea...</description>
<link>http://www.dci.org/news/view.cfm?news_id=5571dc79-6940-42e6-a435-b4893fccc133</link>
<news_date>2014-12-17T10:47:00-06:00</news_date>
</item>
HTML:
<item>
<title>2014 Open Class World Championship video sampler</title>
<description><div align="center"><iframe width="620" height="349" src="//www.youtube.com/embed/fBLPYhHatGg?list=PL-1dy9pmiSAS0Z0iTONfBIJOfoewGoCvI" frameborder="0" allowfullscreen></iframe></div>
The first corps to take the field during the Prelims competition...</description>
<link>http://www.dci.org/news/view.cfm?news_id=0a92bb20-9187-4689-ae92-fbe1a5a631f6</link>
<news_date>2014-12-17T01:24:00-06:00</news_date>
</item>
【问题讨论】:
标签: html objective-c xml xml-parsing rss