Wriju's BLOG

.NET, Cloud and everything

XLinq for RSS Feed

 


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