1

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

Sambo
  • 181
  • 1
  • 4

1 Answers1

2

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)
};
JT Turner
  • 502
  • 2
  • 14
  • Thank JTWebMan, you code is work. But it cannot get any elements if RSS have RDF namespace. I just find solution from this post http://stackoverflow.com/questions/1583086/linq-to-xml-applying-an-xpath – Sambo Aug 29 '11 at 08:39