Click here to Skip to main content
16,016,227 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I'm trying to make an app for Windows Store get RSS feed from a web site. Here is the RSS source:
<title> some data </title>
<description> some desc </description> 
<link>http://www.****.com</link>
<pubDate>Fri, 21 Jun 2013 19:30:48</pubDate>
<guid>ttp://www.****.com</guid>
<enclosure url= "http://www.***.com//images/332010.jpg " length="5000" type="image/jpge"/>

And the code to read from it:
C#
XmlDocument RSSXml = await XmlDocument.LoadFromUriAsync(new Uri(uri));
XmlNodeList xmlUrl = RSSXml.GetElementsByTagName("enclosure");
XmlNodeList RSSNodeList = RSSXml.SelectNodes("rss/channel/item");
StringBuilder sb = new StringBuilder();
foreach (var RSSNode in RSSNodeList)
   {
        var RSSSubNode = RSSNode.SelectSingleNode("title");
        string title = RSSSubNode != null ? RSSSubNode.InnerText : "";
        RSSSubNode = RSSNode.SelectSingleNode("link");
        string link = RSSSubNode != null ? RSSSubNode.InnerText : "";
        RSSSubNode = RSSNode.SelectSingleNode("enclosure");
        string desc = RSSSubNode != null ? RSSSubNode.InnerText : "";
    }
Label.Text = sb.ToString();

It all works fine expect for "enclosure" value, I need to get the "url" value and I tried a lot of formats but didn't get any thing and some times get errors. Any help.
Note 1 : There is no System.ServiceModel.Syndication in W8 store apps it just Windows.Web.Syndication and this one doesn't accept XmlReader.Creat(uri) as param.
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900