Content Syndication using RSS


RSS is a popular format for syndicating content over the web. As a website owner, you attract more repeat customers to your site if you allow the users to consume your content using content aggregation technology like RSS. At the users end, they can use a feed aggregator or any RSS Reader software to read your published content.

Here is the Wiki definition of RSS,

RSS is a family of XML dialects for Web syndication used by (among other things) news websites and weblogs. The abbreviation is used to refer to the following standards:

  • Rich Site Summary (RSS 0.91)
  • RDF Site Summary (RSS 0.9 and 1.0)
  • Really Simple Syndication (RSS 2.0)

The technology of RSS allows Internet users to subscribe to websites that have provided RSS feeds; these are typically sites that change or add content regularly. To use this technology, site owners create or obtain specialized software (such as a content management system) which, in the machine-readable XML format, presents new articles in a list, giving a line or two of each article and a link to the full article or post.

Since Netscape’s creation of original version of RSS ( ver 0.90 ), it has gone through many
revisions. (0.91, 0.92, 0.93, 0.94…1.0 and now 2.0). The format of RSS 2.0 looks like this,

<rss version="2.0" xmlns:dc="http://directkerala.com/ns/">
<channel>
<title>DirectKerala.com</title>
<link>http://www.directkerala.com/</link&gt;
<descriptionvDirect Kerala is Kerala's no.1 portal</description>
<item>
<title>Movie Review - Rajamanikyam</title>
<link>http://www.directkerala.com/movies/rajamanikyam.aspx</link&gt;
<description>Mammootty’s Midas touch- Rajamanikyam....</description>
<dc:creator>DirectKerala</dc:creator>
<dc:date>2006-02-02</dc:date>
</item>

</channel>
</rss>

Here is a sample ASP.Net program that shows you how to create your own RSS Feed.
In this example, I have a page named rss.apsx , and the following is code for its Page_Load


private void Page_Load(object sender, System.EventArgs e)
{
Rss r = new Rss();
DataSet ds = GetData();
r.OutputStream = Response.OutputStream;
r.RssTitle = "DirectKerala.com";
r.PublisherUrl = Request.Url.Host;
r.Description = "DDirect Kerala is Kerala's no.1 portal";
r.Copyright = "Copyright (C) Direct Kerala Online Services (P) Ltd, DBA DirectKerala.com.";
r.Generator = "DirectKerala.com RSS Generator";
r.ItemSource = ds;
r.ItemTitleField = "ListCaption";
r.ItemDescriptionField = "ListDesc";
r.ItemPublicationDateField = "ListStartDate";
r.ItemUrlField = "ListingCode";
Response.ContentEncoding = System.Text.Encoding.UTF8;
Response.ContentType = "text/xml";
Rss.PublishRss(r);
Response.End();

}

GetData() is the function that gets me the data that need to be publised. The DataSet returned has fields like “ListCaption”, “ListDesc”,… etc. Make sure that the content type is set to text/xml and Rss.PublishRss() method will write the data in RSS 2.0 format to the Response stream.

To be Contd….

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