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 https://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 = "https://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
Comments
Anonymous
December 30, 2006
Beside the point, but I suggest using StringBuilder for concatenating an unknown, arbitrary number of strings.Anonymous
January 02, 2007
Yes you are correct. We should use StringBuilder for concatenating strings. But here we tried to focus more on RSS and XLinq