我正在尝试为Windows应用商店制作应用从网站获取RSS源。 这是RSS源:
> <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"/>
要从中读取的代码:
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();
这一切都很好地期待“封闭”值,我需要获得“url”值,我尝试了很多格式但没有得到任何东西,有时会出错。 任何帮助。