Wednesday, August 30, 2006

RSS Output via .Net XML Serialization

Scott Van Vliet - RSS in .NET Made Easy with XML Serialization


So I was looking for a real quick way to publish an RSS feed from a Web application I created for a friend and found some great articles and components (RSS Toolkit for ASP.NET 2.0.)  However, I didn’t find anything that used XML Serialization (specifically) to work with the RSS 2.0 Specification (maybe my Google skills are truly weak today.)  I use XmlSerializer religiously, and thought it would be quite trivial to build a set of classes to quickly create and publish an RSS feed.   Thus, as any geek would do, I did just that.


To create an RSS document, it’s no more difficult than creating and populating a PONO (Plain Ole .NET Object.)


To generate the XML for this feed, simply call the ToString() method:



That's a pretty cool implementation. A simple strongly typed method to create RSS output (with C# source included) via XML serialization.

I like the PONO approach... ;)

No comments: