Consuming RSS 1.0 (RDF) Feeds in ASP.NET MVC 3

风流意气都作罢 提交于 2019-12-08 07:53:15

问题


Can anyone know how to consume RSS 1.0 in ASP.NET MVC3?


回答1:


I would just use this:

XDocument doc = XDocument.Load(“URL to RSS Feed”);

And then you can query using Linq to XML like this...

var query = from feed in doc.Descendants(“item”)
orderby DateTime.Parse(feed.Element(“pubDate”).Value) descending
select new
{
   Title = feed.Element(“title”).Value,
   Description = feed.Element(“description”).Value,
   Date = DateTime.Parse(feed.Element(“pubDate”).Value)
};


来源:https://stackoverflow.com/questions/7227031/consuming-rss-1-0-rdf-feeds-in-asp-net-mvc-3

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!