RSS is an XML-based format that allows the syndication of
lists of hyperlinks, along with other information, or metadata, that help
viewers decide whether they want to follow the link.
This allows a person's computer to fetch and understand the
information, so that all of the lists that he is interested in can be tracked
and personalized for him. It is a format that is intended for use by computers
on behalf of people, rather than being directly presented to them (like HTML).
To enable this, a Web site will make a feed, or channel,
available, just like any other file or resource on the server. Once a feed is
available, computers can regularly fetch the file to get the most recent items
on the list. Most often, people will do this with an aggregator, a program
that manages a number of lists and presents them in a single interface.
Feeds can also be used for other kinds of list-oriented
information, such as syndicating the content itself (often weblogs) along with
the links. However, this tutorial focuses on the use of RSS for syndication of
links.
Here is an example of a minimal RSS 2.0 feed:
Listing 1
<?xml version="1.0"?>
<rss version="2.0">
<channel>
<title>Example Channel</title>
<link>http://example.com/</link>
<description>My example channel</description>
<item>
<title>News for September the Second</title>
<link>http://example.com/2002/09/01</link>
<description>other things happened today</description>
</item>
<item>
<title>News for September the First</title>
<link>http://example.com/2002/09/02</link>
</item>
</channel>
</rss>
Currently, nearly all web sites provide support for RSS 2.0. From the above listing we can see that a RSS file is mainly composed of
nodes, such as rss, channel, item, etc. Here, node rss specifies
the namespace to abide by; node channel represents one
category in some blog or new group, while item corresponds
to the main info for users to view, including titles, hyperlinks, pub-date,
etc. The following table lists the standard elements that constitute an RSS
file.
Table 1: Elements within a RSS 2.0 channel
Element
|
definition
|
Title
|
The title of this channel
|
Link
|
The hyperlink of the web site for the channel to be linked
to
|
Description
|
The description information for this channel
|
Language
|
(omitted)
|
Copyright
|
(omitted)
|
managingEditor
|
(omitted)
|
webMaster
|
The information of the main manager of the web site
|
pubDate
|
(omitted)
|
lastBuildDate
|
(omitted)
|
image
|
The image information within this channel
|
Note you can refer to this address
for all the elements contained in a RSS 2.0 file.
Dmitry Robsman's ASP.NET RSS Toolkit
In this article we will seek help to the famous open source
RSS toolkit—RssToolkit (authored by
Microsoft Dmitry Robsman, which can be downloaded from http://blogs.msdn.com/dmitryr/) to serve
as an agent between this sample application and the RSS channel information because
currently there are many versions available for RSS subscription, such as 0.90,
0.91, 0.92, 0.93, 0.94, 1.0 and 2.0, with various small differences between
them. Also, to directly work with the different versions, you have to exert
tremendous effort.
Concretely, this toolkit supplies the following main
features:
·
RssDataSource control to consume feeds in ASP.NET applications:
1) Works with ASP.NET data bound
controls
2) Implements schema to generate
columns at design time
3) Supports auto-generation of
columns at runtime (via ICustomTypeDescriptor implementation)
·
Caching of downloaded feeds both in-memory and on-disk (persisted
across process restarts)
·
Generating strongly typed classes for feeds (including strongly
typed channel, items, image, handler) based on a feed URL (the toolkit
recognizes RSS, Atom and RDF feeds) or a file containing a sample feed and allowing
programmatically download (and creation) of feeds using strongly-typed classes.
So much for the RSS introduction! Let us now focus on our
main topic.