Walt's Article Home

Original Articles

ArticleDefault

ChallengerAccidentReview

OPMLFeedDisplay

SimpleBooks

SimplestArticles



OPML Feed Display Control

A Web User Control for Displaying OPML RSS Feed Lists

Walter Lounsbery, 12-26-2007

This is my first software project article for my Lounsbery.com Website.  As any Web-watcher knows, most Websites and grand plans for Web content suffer greatly from neglect and inattention.  Let's look on the bright side here, after almost ten years since acquiring the Lounsbery.com domain, I am fulfilling an original vision for my Website.  A dream is becoming reality, so why ruin the occasion by noting that I procrastinated from one millennium to the next?

Let's set the expectations for this great beginning.  This is public domain software, intended to provide some very basic function.  My intention is to have lots of short projects with a precise focus, plus a few handy tools that I've developed.  At this point, the code and the execution may not be pretty, but it will be functional.  The projects can be polished up if you like or easily refactored into some other architecture or design paradigm.  I won't presume to know what you think is a better architecture or design approach.  I will try to make these things "patch and play" or "plug and play" with your other software.  Therefore the demonstration projects are as small and brief as possible.

The Objective

I use the RSS Bandit feed reader by Dare Obasanjo, Torsten Rendelmann, Phil Haack, and other contributors.  My feed list has hundreds of sources, and it is locked inside the RSS Bandit application on my workstation.  While RSS Bandit has the ability to export the feed list as an OPML file, or share the feed list on a remote store, I would like to simply display the exported OPML feed list on a Web page so I can click through to the source Websites or copy the feed URLs from any browser.  That way I don't have to run RSS Bandit to get a particular reference when I'm away from my desk.

The Approach

 If you are familiar with XML and .NET, you know there are lots of ways to convert OPML to HTML for display on a Web page.  Having tracked XML technologies practically from the beginning, the variety of approaches hinging on XSLT, XPATH, XQUERY, XDOM, or other XACRONYM is as dazzling as the many and various versions and syntaxum.  .NET supports many of those techniques.  Considering the limited number of elements and attributes in RSS Bandit's OPML file, the heirarchical data structure, and the direct functionality of the .NET XMLreader, I opted to go with a die-hard coder's approach.  If the end justifies the means, then this worked out really well.  The majority of the code fits on my workstation screen and doesn't require reading extra files or invoking transformation libraries.  It is also compatible with .NET version 2.0, although you will need to down-convert the project from .NET 3.5 (Visual Studio 2008 does a good job with that).

This project has a specialized OPML class that reads the RSS Bandit OPML file and creates an object tree containing the file data.  The Web user control scans the current directory for OPML files and uses the OPML class to read the first one it encounters.  It contains code that generates an HTML table to display the categories and feeds, using indentation to show the levels of the hierarchy.  The table is injected into the Web user control via an ASP.NET Literal control.

Discussion

If you are curious about the code, check out the demo project. A picture may be worth a thousand words, but you will get a better understanding of the design by looking at the project, its files, and running the Website in debug mode. After you do that, you will probably have several ideas for improving the control.  Go ahead and try them out!  Feel free to send me your improvements or links to your development.

I feel the control does a reasonable job of displaying my feed list.  I've put it on the Lounsbery.com Website.  Now I can just export the current OPML feed list from my workstation RSS Bandit and copy that into the proper directory on my Website to display an updated list.  It is a simple and effective solution.

   Page Updated 12/26/2007     © Copyright 2007, Walter Lounsbery