Articles |
 |
Developer News |
 |
|
|
| Want to receive new articles via e-mail? Click here! |
/Home
/XML
 |
RSS: Really Simply Syndication  |
|
|
|
|
Synopsis:
Using XML can provide an amazingly versatile method of syndicating content on your website. The most common usage today is that of the humble news/blog RSS feed. |
|
|
The Article
RSS: Really Simply SyndicationIntroductionThis paper summarises the basics of using RSS to provide syndicated content. I will be using the RSS 2.0
specification simply because that is my personal preference. There are
a number of alternative specifications available, but I will not be
looking that those.
The author, Peter Cowburn, has been working with XML in conjunction with a variety of other web technologies for over 6 years.
RSS is XMLThat's
correct! Building on the amazingly versatile eXtensible Markup
Language, RSS is a useful application of XML. This explains the way RSS
is marked up in XML style tags.
The Structure of RSSAll RSS documents absolutely must contain the root element <rss> within which there can only be a single <channel>
element. Do not do it any other way! The basic meaning when 'reading'
the RSS file is that first we are actually in an RSS document (the
"rss" tag) and have a channel (the "channel" tag). Only three other
tags are 100% necessary in any RSS document, namely; <title>, <link> and <description>.
There are a whole host of other tags which can optionally be used within the "channel" which are: category,
cloud, copyright, docs, generator, image, item, language,
lastBuildDate, managingEditor, pubDate, rating, skipDays, skipHours,
textInput, ttl and webMaster. Details of these are listed in the specification. The commonly used ones are pubDate and lastBuildDate as they are of use to RSS Feed Aggregator programs. However the most important is the item tag!
The item tag
The channel can contain any number of items (though having none would
be silly); think of them as stories in a newspaper or entries in a
blog. The available tags which can be used within an item tag are author, category, comments, description, enclosure, guid, link, pubDate, source and title. Note that all of the tags are optional individually but the item tag must contain at the very least either a description or title tag.
A bare-bones example
Below is an example of a minimal RSS feed, note that this is not the
absolute minimum required in an RSS document but just contains the most
commonly used tags. Note: required tags are coloured green.
<rss version="2.0">
<channel>
<title>My Personal Blog</title>
<link>http://www.mypersonalblog.com</link>
<description>A small web log all about me.</description>
<pubDate>Tue, 2 Nov 2004 14:48:32 GMT</pubDate>
<lastBuildDate>Tue, 2 Nov 2004 14:48:32 GMT</lastBuildDate>
<item>
<title>The Weather Today</title>
<link>http://www.mypersonalblog.com/the-weather-today/</link>
<description>
I looked out of the window this morning and it was
pouring with rain. Obviously my first reaction
was to turn over and go back to sleep.
</description>
</item>
</channel>
</rss>
More real-world example
Most commonly RSS documents are used for news/blog feeds, so I will
give you a quick example (modified from my own web log). Note the
various groups of tags are coloured to distinguish groups.
<rss version="2.0">
<channel>
<title>cowburn</title>
<link>http://blog.cowburn.info/</link>
<description>Web, Life and Photography</description>
<language>en-us</language>
<pubDate>Tue, 2 Nov 2004 14:48:32 GMT</pubDate>
<lastBuildDate>Tue, 2 Nov 2004 14:48:32 GMT</lastBuildDate>
<item>
<title>So you want a photolog?</title>
<link>http://blog.cowburn.info/archives/2004/11/2/photolog/</link>
<description>
I have been working on re-arranging this site so that the different
areas (Blog, Photos, etc) will all appear consistantly, styled along
the same theme.
</description>
<pubDate>Tue, 2 Nov 2004 14:48:32 GMT</pubDate>
</item>
<item>
<title>Got Logo?</title>
<link>http://blog.cowburn.info/archives/2004/11/1/logo/</link>
<description>
Out of the goodness of my heart, I have decided to help those
designers out who are non-logoly gifted in a contest which is
going on over at yaXay currently.
</description>
<pubDate>Mon, 1 Nov 2004 19:12:02 GMT</pubDate>
</item>
<item>
<title>Birnie 2004</title>
<link>http://blog.cowburn.info/archives/2004/10/30/birnie/</link>
<description>
For those of you wondering where on earth I have been for the
past month or so, fear not for I am about to enlighten you.
I have been digging up in the North East of Scotland excavating
the lovely settlement site of Birnie in Moray.
</description>
<pubDate>Sat, 30 Oct 2004 22:19:58 GMT</pubDate>
</item>
</channel>
</rss>
Summary
So, essentially we have covered the very basics of what RSS is all
about and what the documents look like. In the real world RSS
documents are generally generated on-the-fly whenever a new news
article or blog entry is published. This is an area not to be
covered in this paper but there are many methods of achieving this to
be found around the internet.
Happy publishing!
|
|
|
| Similar/related articles:
|
|
|
|
Sponsors |
 |
|
|
|