Reputation: 48686
What I'm trying to do is take an RSS feel URL and, using LINQ, be able to write a query that will let me sort the subject line of the feed or sort the author line of the feed or even do 'WHERE' clauses that will let me filter by keywords for example.
I know I can read the RSS feed, parse each element, put them into some sort of class object collection and LINQ off that, but I was wondering if Microsoft provided a simpler way to do this in the .NET framework.
Upvotes: 5
Views: 1649
Reputation: 7238
You should have a look a the SyndicationFeed class.
var reader = XmlReader.Create("http://url.to/rss");
var feed = SyndicationFeed.Load(reader);
//Find items by Jesper
feed.Items.Where(i=>i.Authors.Any(p=>p.Name == "Jesper"));
//Order by publish date
var ordered = feed.Items.OrderBy(i=>i.PublishDate);
Upvotes: 9
Reputation: 2232
Maybe this is what you are searching for:
http://codebetter.com/blogs/jeffrey.palermo/archive/2007/10/13/linq-to-xml-querying-an-rss-feed.aspx
Upvotes: 4