Introduction
RSS Consumer is an RSS client that reads RSS feeds from any URL that points to an XML file over the web. It also allows the user to save any other non-RSS links. The user can arrange and organize his links by creating groups, that are saved in an XML file called the XMLFeedLibrary.xml, stored in a separate folder under the application folder.
The application is developed in .NET using C# and XML.
Background
An RSS feed is a regularly updated XML document that contains metadata about a news source and the content in it. Minimally, an RSS feed consists of a channel
that represents the news source, which has a title
, link
, and description
that describe the news source. Additionally, an RSS feed typically contains one or more item
elements that represent individual news items, each of which should have a title
, link
, or description
.
Note: The aforementioned elements appear in most RSS feeds but are not the only ones that can appear. Many RSS feeds also contain additional elements such as date
or language
. However, these elements and many others appear less commonly in practice.
There are many advanced RSS aggregators and clients available for free over the net. Requirements to develop an RSS aggregator is available at MSDN.
Using the RSS Consumer
To use the RSS Consumer, you need to first install the .NET framework on your machine. The interface is quite simple to use.
The application makes good use of the System.Xml
library. The feeds are read by using the xmlDocument.Load()
method of the xmlDocument
object. The following code block explains how the RSS feeds are read and listed in the feed listview control. Once the links are listed, the user can browse each of the links by a single click.
public void FetchFeedInfo(string strFeedURL, string SearchNodeText)
{
try
{
if(!SearchNodeText.Trim().Equals(""))
{
ClearFeedList();
this.Cursor=Cursors.WaitCursor;
XmlDocument xDoc=new XmlDocument();
xDoc.Load(strFeedURL);
XmlNodeList xnList=
xDoc.DocumentElement["channel"].SelectNodes(SearchNodeText);
foreach(XmlNode xNode in xnList)
{
ListViewItem lstFeedItem=new ListViewItem();
for(int i=0;i < xNode.ChildNodes.Count;i++)
{
lstFeedItem.ImageIndex=0;
if(i==0)
{
lstFeedItem.SubItems.Add(xNode.ChildNodes[0].InnerText);
lstFeedItem.SubItems.Add("");
lstFeedItem.SubItems.Add("");
lstFeedItem.SubItems.Add("");
}
if(i==1)
{
lstFeedItem.SubItems.Add(
xNode.ChildNodes[1].InnerText.Substring(0,10));
}
if(i==2)
{
lstFeedItem.SubItems.Add(xNode.ChildNodes[2].InnerText);
lstFeedItem.Tag= xNode.ChildNodes[2].InnerText;
}
}
lstvFeed.Items.Add(lstFeedItem);
}
this.Cursor=Cursors.Default;
if(lstvFeed.Items.Count>0)
{
Object o=null;
lstvFeed.Items[0].Selected=true;
axWebBrowserFeed.Navigate(lstvFeed.SelectedItems[0].Tag.ToString(),
ref o,ref o,ref o,ref o);
}
}
else
{
}
}
catch(Exception ex)
{
this.Cursor=Cursors.Default;
MessageBox.Show(ex.Message + " : " + ex.StackTrace);
}
}