ASP.net C #. How to parse an Atom feed from a blog

Innings:

http://latestpackagingnews.blogspot.com/feeds/posts/default

I want tags:

<entry> <published></published> <title></title> <content></content> </entry> 

I don't care, all I want to do is loop! Please do not post textbook links. I tried a bunch and just cant get them to work. Treat me like an idiot, please.

+3
c # atom-feed
Feb 24 '11 at 10:44
source share
1 answer

You can look at the System.ServiceModel.Syndication.Atom10FeedFormatter class. (System.ServiceModel.dll)

 static void Main(string[] args) { Atom10FeedFormatter formatter = new Atom10FeedFormatter(); using (XmlReader reader = XmlReader.Create("http://latestpackagingnews.blogspot.com/feeds/posts/default")) { formatter.ReadFrom(reader); } foreach (SyndicationItem item in formatter.Feed.Items) { Console.WriteLine("[{0}][{1}] {2}", item.PublishDate, item.Title.Text, ((TextSyndicationContent)item.Content).Text); } Console.ReadLine(); } 
+10
Feb 24 '11 at 10:50
source share



All Articles