XLinq for RSS Feed

XLinq for RSS Feed

Rate This
  • Comments 2

 

RSS 2.0 is popular in the world of BLOGGING. Let’s not discuss about what RSS does but how we can read RSS using XLinq (LINQ for XML). Here I have tried to read the RSS Feed of my BLOG and the URL for the RSS feed is http://blogs.msdn.com/wriju/rss.xml  

 

This simple function pulls out the RSS XML details provided you know the structure.

 

string GetOutput()

        {

            string strOut = string.Empty;

            string strFeed = "http://blogs.msdn.com/wriju/rss.xml";

 

            var feed = XDocument.Load(strFeed);

            var items = feed.Root.Element("channel").Elements("item");

            foreach(var item in items)

                strOut+= item;

 

            return strOut;

        }

 

Once you have the core XML in your hand using the .NET XML namespace you can play with it. It is really interesting.

 

Welcome 2007!!!.

 

Namoskar

 

Leave a Comment
  • Please add 6 and 1 and type the answer here:
  • Post
  • Beside the point, but I suggest using StringBuilder for concatenating an unknown, arbitrary number of strings.

  • Yes you are correct. We should use StringBuilder for concatenating strings. But here we tried to focus more on RSS and XLinq

Page 1 of 1 (2 items)