Tags

, , , , , , , ,

Although Microformat standards have been around for some time now, there’s been relatively little mention of them considering it’s potential effect on the way we exchange data, so I’ve decided to cover the basics here.

What Are Microformats?
These are open data formats built ultimately on XML and XHTML. Metadata can be included in standard XHTML, making a script ‘semantic HTML’. The objective is to embed tags and attributes that make this metadata readable by both humans and machines, and this takes us a big step closer to the ‘semantic web’. So potentially, software applications can make use of data included in web pages. In fact, information can be downloaded from a URL without even having to open a web browser. For example, an address book for an email client can add the contact details of the web site’s author, and calendar dates posted on a web page can also be automatically added to calendar software. Alternatively, a web browser can act as a manager for this data, downloading it from a web page and forwarding it to specific software.

A common example of Microformat data is the hCard. The XFN standard I’ve wrote about in the past is also classed as a Microformat, which is why I’m currently replacing the XFN tab with the Microformat one on my sites.

The Code
Below is a common example of the Microformat code for an hCard:

Michael

BEATRIXNET
Developer HQ, Queen Street

Cardiff,
South Glamorgan,
CF5 2GH
UK

0123 456789

It might look daunting to some, but the basics are very easy to understand, and there are only about two dozen (optional) attributes in the hCard specification. First of all, Microformat tags usually include the class attribute in a span tag, although others are used, such as rel in href to include relationship data in a link.
In most cases, you want to include your name in Microformat data, and this is done with the fn (formatted name) class, e.g:


John Smith

The above tag can form an hCard with the addition of just another tag. So the code would be:



John Smith

So there we have a basic hCard with just a name. To add more information to this hCard, all we need to do is add another tag for email address, another for URL, etc.
Some may wonder why ‘vcard’ is declared instead of ‘hcard’. Mostly this is because Microformats are based on the same standard as vCard and iCalendar.

Types and Support
The main Microformat types already established are hCard, geo and hCalendar. These build on previous standards like vCard and iCalendar, so existing software applications, email clients, etc. should be able to import and process these.

There have been talks of modifying the FireFox browser so it not only acts as a web browser, but also as a distributor of Microformat data to other applications installed on a system. For example, the browser can retrieve an hCard from a site and automatically forward that data to an email client. At the moment it’s not certain how a common framework between these applications and the browser can be established, or how we can prevent Microformats being another carrier of spam.

Operator
Recently I’ve been having a look at the Operator extension for FireFox, which is some code developed by Mozilla Labs designed work as a ‘Microformat detector’ that picks out data on a web page. It works pretty well, as it displays a toolbar with Microformat icons for contacts, dates, etc, and gives the user control over which of these are processed. Currently the Operator features include:
– Adding Yahoo Local contacts to the address book.
– Adding Upcoming.org events to a calendar
– Matching blog and Flickr tags. This works well with XFN.
– Showing the location of where a Flickr image was taken

Operator can also be customised to handle extra data types, handlers and actions.

Download the PDF version of this article…

Useful Links:
Microformat Site
Operator FireFox Extension
XHTML Friends Network

Advertisements