Combine RSS Feeds and Display Random Items

I added a new code sample to the XML for ASP.NET Developers Website (http://www.xmlforasp.net) that deals with RSS feeds.  Here's more information about it:

Combine RSS Feeds and Display Random Items

This code sample demonstrates how multiple RSS feeds can be combined, parsed, and displayed using the XmlTextReader and XmlTextWriter classes in the .NET framework. It can display all items found in one or more RSS feeds or display only a few items in a random manner.  Ben Miller (Microsoft MVP Lead for ASP.NET, IIS, and Web Services) and I talked a little about doing this last night and this sample was put together as a result.

The code parses the RSS feeds using the XmlTextReader, creates an RSSItem struct for each item and adds it to an array. It then uses the array to generate a random list of feed items that can be displayed. The data within the array is converted into HTML by using the XmlTextWriter class. The XmlDocument class could have been used to merge the RSS feeds together as well but this example provides a more stream-based API that is less memory intensive.

You can see a demo of the code and download everything involved here:  http://www.xmlforasp.net/CodeSection.aspx?csID=112

comments powered by Disqus

No Comments