Views and Feelings

My Photo
Name:
Location: Amsterdam, Netherlands

Tuesday, 24 June 2008

How to do hCalendar in RDFa

Now that the BBC has announced that it is dropping use of hCalendar because of its accessibility problems, it is time to show how to define events using RDFa.

The events vocabulary for RDF was defined from 2002 by Dan Connolly and Libby Miller in RDF Calendar. Its use is identified by including the following declaration in your document, for instance as an attribute on the <html> element:

xmlns:event="http://www.w3.org/2002/12/cal#"

The markup for an event, in this case a TV program, can then look like this:

<div typeof="event:Vevent">
<h3 property="event:summary">Have I Got Old News For You</h3>
<p property="event:location">BBC2</p>
<p><span property="event:dtstart" content="2008-06-28T21:00:00">Saturday 28 June,
9</span>-<span property="event:dtend" content="2008-06-28T21:30:00">9.30pm</p>
<p property="event:description">Team captains Paul Merton and Ian Hislop
are joined by returning guest host Jeremy Clarkson and
panellists Danny Baker and Germaine Greer for the
topical news quiz. <abbr title="in stereo">[S]</abbr></p>
</div>

There are no requirements on the order of enclosed elements. For instance here is a description of a conference:

<div typeof="event:Vevent">
<h3 property="event:summary">WWW 2009</h3>
<p property="event:description">18th International World Wide Web Conference</p>
<p>To be held from <span property="event:dtstart" content="2009-04-20">20th April 2009</span>
until <span property="event:dtend" content="2009-04-24">24th April</span>, in
<span property="event:location">Madrid, Spain</span>.</p>
</div>

If you want to validate your page, then replace the DOCTYPE you use with

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML+RDFa 1.0//EN"
"http://www.w3.org/MarkUp/DTD/xhtml-rdfa-1.dtd">

Labels: