Sunday, April 18, 2010

Is RSS Really That 'Simple'

XML provides the underlying framework of Web 2.0 applications. A key application of XML is website syndication or what was once termed 'push' technology. RSS stands for Real Simple Syndication and theoretically provides the following items in XML format:

  • Title
  • Link
  • Description

In practice, however, this idea has been extended ad infinitum due to the extensibility of RSS and XML.  In essence, there are about 9 ways to encapsulate these three items in an XML file.  This leads to a robust use of the concept without any bullet-proof method of decoding RSS files.  I have read many bulletin board postings made by programmers seeking the best ways of decoding RSS to create a reader application, but have found many of the answers leaving only more questions on the subject.  I believe the best approach to the problem is the Object Oriented solution.

A RSS Reader application in its most basic form would:

  1. Retrieve an RSS file from a website
  2. Display a list of Titles from the file
  3. Display the Description of a given Title
  4. Provide the Link back to the underlying web page

The VB.Net object XMLDocument has the ability to retrieve an XML file directly from the web, making the first step relatively simple.  Add the following to the General Declarations section of your class:

Imports System.Xml   

Then declare a member of the type XMLDocument as a member of your class:

Private m_XMLDocument As New XmlDocument

To load a file, call the Load method passing the RSS feed URL as an argument:

m_XMLDocument.Load("http://mydomain.com/myfeed.rss") ' Create an XML Document to work with

Now that the RSS feed is loaded into the XMLDocument object processing is not as straightforward as one would think.  This is because of the various versions of RSS files than can be used.  The solution to this problem would suggest an Object Oriented design approach.  In future posts on this blog I will share the object model I used to solve the problem, explain the various formats, explain how to find the various information in various formats, and show how to handle extension information as Meta Data within the classes using dictionaries based on the name spaces. 

My hopes are this blog will help programmers better utilize Object Oriented Design, build applications that deal with RSS effectively, and lead to a mastery of Web 2.0 to lead us into the creation of Web 3.0 applications. 


No comments:

Post a Comment