A question was asked on the MSDN Smart Device Development Forum this morning regarding Synchronization using RSS (http://bit.ly/L88qA). I responded with a number of links to the OpenNETCF's SDF documention for their RSS namespace and a link to Alex Yakhnin's blog post "Taking OpenNETCF.Rss for a spin." (http://bit.ly/XHsjp).
I am a keen subscriber to a number of blog posts via this mechanism so I have an interest in this, I even subscribe to various blogs on my HTC Diamond device, so I wanted to know more about this namespace. I didn't have much time this morning to have a play with Alex's example application so I had a look after work.
As the SDF now includes the OpenNETCF.Rss namespace I opened Alex's example and removed the OpenNETCF.Rss project and referenced the OpenNETCF.Rss namespace from the SDF2.3 installation on my machine. Building this then lead to a number of build errors relating to other changes in the SDF, I didn't really have time to correct all the build errors and all I really wanted to do was to prove that I could download some data via this mechanism so I started a new solution that would just download the name of the feed and the names of the feed items. I may come back to this and correct the other build errors at some point.
I started writing some code however ran into a problem with a configuration I needed to provide, which Alex's example provided. After loading the config file into an XmlDocument I then proceeded extracting the relevant XmlNode and passing it to the StorageConfiguration.Load and TransportConfiguration.Load methods.
The second issue I came across was that the version of the OpenNETCF.Rss assembly was slightly out of date in Alex's config file so I updated it from 184.108.40.206 to 220.127.116.11.
All was going well, the config was loaded successfully, now all I needed to do was to call the Receieve method on a valid RSS feed URL. I tried my Twitter account however that requires additional user credentials, I then tried the MSDN forum however that didn't work (it didn't seem to work in Snackr either, but thats another story), I then tried Neil Cowburn's blog (http://bit.ly/166fYW) and that worked successfully.
I now have the title of the Feed in a label and the titles of the Feed Items in a listbox.
The following is the code I have :-
XmlDocument currentConfig = new XmlDocument();
XmlNode currentNode = currentConfig.DocumentElement;
XmlNode feedNode = null;
foreach (XmlNode currentChildNode in currentNode.ChildNodes)
string nameofchildnode = currentChildNode.Name;
feedNode = currentChildNode;
OpenNETCF.Rss.Data.Feed currentFeed = OpenNETCF.Rss.FeedEngine.Receive(new Uri(@"http://feeds.feedburner.com/neilco?format=xml"));
this.label1.Text = currentFeed.Title;
foreach (OpenNETCF.Rss.Data.FeedItem currentFeedItem in currentFeed.Items)
Along with the config file :-
<?xml version="1.0" encoding="utf-8" ?><configuration> <configSections> <section name="feed.net" type="OpenNETCF.Rss.Configuration.FeedConfiguration, OpenNETCF.Rss, Version=18.104.22.168, Culture=neutral, PublicKeyToken=null " /> </configSections>
<feed.net> <communication> <refreshInterval value="60000" /> <transports> <add scheme="http"> <defaultPort value="80" /> <receiveTimeout value="90000" /> <noDelay enabled="true" /> <connectionLimit inbound="16" /> <serializer type="OpenNETCF.Rss.FeedSerializer,Version=22.214.171.124,Culture=neutral,PublicKeyToken=null" /> <hosts default="allow"> <allow /> <deny /> </hosts> </add> </transports> </communication>
<storage> <provider name="fileStorage" enabled="true" type="OpenNETCF.Rss.FeedFileStorage,OpenNETCF.Rss,Version=126.96.36.199,Culture=neutral,PublicKeyToken=null"> <path value="\Temp" /> <feedSizeLimit value="250" /> </provider> </storage>
Hopefully this experience will help someone else.