Lightweight Syndication feed reader and GeoRSS

Syndication feeds often use RSS or Atom feed formats. Reading and parsing these feeds in Silverlight can be done using one of several methods.

One common method is to use the System.ServiceModel.Syndication assembly. Unfortunately this assembly has a few bugs in it and depending on the feed it may throw an error when trying to parse a date. Besides being prone to errors it is also 114KB in size which can quickly increase the size of your XAP file.

Another method is to use System.XML.Linq with XDocument. This assembly tends to be more reliable but is 122KB in size.

One of the requirements for the applications made for the Bing Maps App API is that the total compressed file size has to be under 100KB. The purpose for this is to ensure that the map apps load quickly. This makes sense and suggests that we should try and make all our Silverlight applications as small as possible to ensure that they load fast.

I have built a few Bing Map apps that read in RSS and Atom feeds and after trying several different assemblies I eventually ended up using XmlReader in System.XML. The benefit of using this assembly is that it is one of the core assemblies and does not need to be downloaded by the user if they have Silverlight installed. I created a simple feed reader that reads RSS and Atom feeds. This assembly is only 10KB in size making it ideal for Bing Map Apps.  As a bonus the bulk of this code as already gone through security testing for the Bing Maps App API which is one less thing to worry about.

When building this syndication reader assembly I decided to make the base feed reader extendable. In the sample application I show how to extend this base feed  reader to be able to read GeoRSS files. GeoRSS is a common xml data feed type that extends the RSS xml feed schema. It is also often used in Atom feeds. The Bing Maps AJAX control has a built in method for importing this data in but the Silverlight control doesn’t.

You can find the complete source code and sample application for these lightweight syndication feed reader here: http://cid-e7dba9a4bfd458c5.office.live.com/self.aspx/VE%20Sample%20code/SyndicationReader.zip

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s