Wednesday, November 30, 2022
Code Search
Code Bank
.NET Applications
XSD Schema Generator
.NET/XML Training


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 briefly discussed doing this and I ended up with this code sample 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.

Teaches XmlTextReader, XmlTextWriter
Requirements .NET 1.1
Download Code: Click Here


.NET, SharePoint and Silverlight Training Solutions
    Online, Onsite and Video Training on .NET and SharePoint technologies available through The Wahlin Group.

© 2007 Wahlin Consulting LLC
XML for ASP.NET Developers in bookstores