0

我正在尝试让 Windows Store 的应用程序从网站获取 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();

对于“enclosure”值,一切正常,我需要获取“url”值,我尝试了很多格式,但没有得到任何东西,有时会出错。任何帮助。

4

0 回答 0