Handle HTML in RSS XML Parser



I am using MWFeedParser from Cocoapods to parse a news RSS feed. Works beautifully.


But when a news item's description contains HTML (for video embedding, for example), I don't quite know how to handle it. The feed URL is: DCI News Feed


Here are 2 news items from the feed. The first is a basic item that doesn't give me trouble. The second contains HTML to embed a YouTube video. It causes the description attribute to display the raw text. I'd like to recognize the HTML and not have it displayed, but do display the actual description which follows the HTML (in this case).


No 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://ift.tt/1K8ei8K;
<news_date>2014-12-17T10:47:00-06:00</news_date>
</item>


HTML:



<item>
<title>2014 Open Class World Championship video sampler</title>
<description>&lt;div align=&quot;center&quot;&gt;&lt;iframe width=&quot;620&quot; height=&quot;349&quot; src=&quot;//www.youtube.com/embed/fBLPYhHatGg?list=PL-1dy9pmiSAS0Z0iTONfBIJOfoewGoCvI&quot; frameborder=&quot;0&quot; allowfullscreen&gt;&lt;/iframe&gt;&lt;/div&gt;

The first corps to take the field during the Prelims competition...</description>
<link>http://ift.tt/1vTAJ7Z;
<news_date>2014-12-17T01:24:00-06:00</news_date>
</item>

No comments:

Post a Comment