Programming with Microformats

For simple microformats, including the ones that depend on rel-design-pattern, it should be simple enough to write your own code to parse data from and write data to the appropriate rel and rev attributes. It takes a lot more work to handcraft parsers for complicated microformats such as hCard and hCalendar because there are many possible properties.

There are no schemas for microformats, only specifications written for direct human interpretation, which makes difficult any autogeneration of ­high-­quality ­language-­specific parsers from the specifications.[313]

A challenge in working with microformats is the lack of validators. Norm Walsh argues that W3C Schema and ­Relax-­NG will not work for the purpose of expressing the syntax of microformats as schemas, though Schematron might be up for the task.[314][315]

Hence, you will need to look for some handcrafted ­language-­specific libraries to handle microformats. Start by looking at

Language-Specific Libraries

Here are some ­language-­specific libraries:

  • mofo ( is a new Ruby library that has support for a variety of microformats including hCard, hCalendar, and xfn.

  • uformats ( is another Ruby library that has support for hReview, hCard, hCalendar, rel-tag, rel-license, and include-pattern.

  • For PHP 5, consider using hKit (, which has support for hCard.

  • Probably the best library out there is Microformats.js, which is the heart of the Operator ­add-­on.[316]

There are interesting things to do with Operator, both for what it can do today and for how it might be a harbinger of things to come in Firefox 3 (which might have native support for microformats).[317]

  • Download and install user-scripts to add new actions and new microformats (http://?

  • Try your hand at writing new actions or support for new microformats by studying existing scripts and the documentation.[318]

  • Study the code for Operator to pick up on the subtleties that go into working code using microformats.[319]

[314] See for more about validating microformats. Erik van der Vlist adds to this analysis at