« Building our Tax Calendar | Main | Open Dispute »

August 19, 2005

Building a feed for our calendar

19 August 2005 This week we'll describe two ways to build a feed which can be used to disseminate the events calendar which we built last week. The easy way to build a feed is to use a Weblogging tool such as Movable Type. Simply build a weblog with only one entry which we'll update regularly to give us the two months rolling calendar. Movable Type does all the hard work, and all we'll do is cut and paste the calendar information into it. You can see how that might look here. And of course, the entry is made available as a feed automatically by Movable Type.

For those who are interested in what a feed really consists of, let's also build one manually.

A feed in its simplest form is a file with a specific format, in our case, RSS 2.0. While there are other formats (such as Atom), for the moment, RSS 2.0 is the most common. It is quite a flexible format and as you'll see it is not that difficult to create.

RSS 2.0 feed dump
First there are the XML and RSS pre-ambles:
<?xml version="1.0" encoding="UTF-8"?> <rss version="2.0">
Everything happens in a "channel":
<channel>
Give the feed a title and link to the parent page:
<title>Tax Due Dates</title> <link>http://www.activeweb.com.au/index.php?option=com_ content&task=view&id=18&Itemid=28</link>
Describe the feed:
<description>Due dates for Australian Tax Office submissions and payments</description>
The language it's written in (Strine):
<language>en-AU</language>
The way it has been generated:
<generator>Hand-coded</generator>
A link to the RSS spec:
<docs>http://blogs.law.harvard.edu/tech/rss</docs>
Ask to be read no more often than every 60 minutes:
<ttl>60</ttl>
At last, this is where we get down to business. A fee can have more than one item, ours only has one.
<item>
For us the title of the item is the same as the feed's title:
<title>Tax Due Dates</title>
The feed represents the event calendar at:
<link>http://evdb.com/calendars/1691</link>
And here is the payload of the feed:
<description> This is where we put our Calendar data </description>
Here is the publication date of the item:
<pubDate>Mon, 15 Aug 2005 17:00:00 +1000</pubDate>
Every feed needs a globally unique identifier, we'll use the feed's URL for that.: <guid isPermaLink="true">http://activeweb.com.au/cal/taxfeed.xml</guid>
</item>
Here is the publication date of the feed:
<pubDate>Mon, 15 Aug 2005 17:00:00 +1000</pubDate> <lastBuildDate>Mon, 15 Aug 2005 17:00:00 +1000</lastBuildDate>
And close the "brackets"
</channel> </rss>

The full feed can be seen here .Of course, we would not normally create this manually. Using a tool like Movable Type or doing it programmatically is a much better option. The purpose of doing it manually here, was to take the magic out of it and show how it's done.

Posted by Marius at August 19, 2005 11:57 AM

Trackback Pings

TrackBack URL for this entry:
http://activeweb.com.au/tm/mt-tb.cgi/20

Comments

Post a comment

Thanks for signing in, . Now you can comment. (sign out)

(If you haven't left a comment here before, you may need to be approved by the site owner before your comment will appear. Until then, it won't appear on the entry. Thanks for waiting.)


Remember me?