There is some work going on at the microformats site to provide a datatypeing mechanism for microformats. XOXO being the most flexible format, it stands to gain much from such a system. While the work is as yet not done, it has come a fair way since I first saw it. Here is a basic overview of the system as it applies to XOXO :
Add the class ‘typed’ to the root XOXO element to specify that this XOXO makes use of datatypeing. Then, to each ‘a’ or ‘dd’ tag add one of the following classes:
- ‘string’ for strings (this is the default if you do not specify a datatype class)
- ‘boolean’ for boolean values (should be in page as ‘1’ or ‘0’)
- ‘int’ or ‘long’ for integer values
- ‘double’ for decimal values
- ‘datetime’ for dates and times (should be encoded using the datetime-design-pattern)
- ‘binary’ for binary data (should be encoded using a data URI)
- ‘nil’ for NULL values
Note that other field types (such as HREF and TITLE) will simply always be treated as strings and this can only be applied to the direct contents of ‘a’ or ‘dd’ field-tags.
The list of XOXO Developer’s Resources has been updated to include the Outline Classes. Written in PHP4 but with compatability built in for PHP5 this set of classes is designed to be able to parse and create XOXO, OPML, hAtom, JSON, and arbitrary XML documents and fragments. The classes are GPL‘ed.
The XOXO Blog Format has been updated to be compatible with hAtom 0.1. The Basic Blogger Template and the template for this blog have also been updated. Please note that the new template is not quite valid hAtom, since the ‘updated’ field is just your Blogger post timestamp format and not proper datetime-design-pattern. This will be fixed as soon as a way to output properly-formatted dates from a Blogger blog is found or the hAtom spec is changed. All applicable XOXO Data Tools either have been updated or will be updated shortly.
XOXO is the most abstract and extensible of all the microformats. While what it can be used for certainly is not infinite, and there are some things it should not be used for, it can certainly be used for a great many varying applications. This post intends to be a discussion of some examples of such use cases.
No Available Microformat
If you want to mark up a part of a webpage in a structured way, either because you feel that a reason for someone wanting to write code to parse the data is probable, or because you wish to write such code yourself, you should first check the microformats list for an existing microformat dealing with your data type. If no suitable microformat exists, XOXO may be the answer. Be careful however, if your particular usage can be generalised into something common across the web that would benefit from standardised markup you may have a candidate for suggesting a new microformat.
XOXO can usually easily be styled using CSS to look the same as a non-XOXO page. This combined with the ease of parsing the format makes it very useful in most cases where data needs to be parseable but there is no existing microformat available. It is reccomended to use ‘standard’ fields (fields not included in the optional DL-list element) wherever possible, however whether or not to use anchor tags when there is no HREF is debateable.
Extending Existing Microformats
XOXO can also be easily used to extend existing microformats. For example, the XOXO Blog Format complies fully with the hAtom microformat, but also adds options for more data to be encapsulated. XOXO is very useful for this because its markup can easily be made to comply with most other microformats, meaning that parsers of the microformat in question will be able to handle it just fine, while XOXO parsers will be able to extract the extra data as well. In addition to this, if the extra data provided by the XOXO extension is stored in ‘Alternate-A fields’, and not in ‘DL-fields’, most microformat parsers can be easily modified to support the extra fields without strict XOXO compliance.
When not to use XOXO
There are a couple reasons not to use XOXO to mark up your data.
- If there is an existing microformat that will serve your purpose as it is (check the microformats list)
- If your use case qualifies for the creation of a new microformat
BoxtheWeb 0.20 has been released, and with it many different new features. One of the most notable, is support for reading lists. Those new to the concept of reading lists may like
this TechCrunch article as a starting point. Basically, the idea is to be able to subscribe to lists of what other people subscribe to. The new version of BoxtheWeb includes ‘subscription boxes’, which allow you to subscribe to XOXO, OPML, or even RSS/ATOM feeds and give a list of feeds referenced. Each of these feeds can then either be previewed or added to your own BoxtheWeb screen.
Each BoxtheWeb account also now publishes a public feed of the its boxes in XOXO and OPML format. This feed can be filtered to contain only feeds or by tag. Boxes may be marked private so that they are not added to this feed. There is no direct mention of the email address anywhere in the URL or the file, only an MD5 hash (although passing an actual address instead of a hash will work, and result in a feed that contains the email address in ownerName). You can see examples of these feeds by clicking the XOXO or OPML links beside ‘Reading List’ in my sidebar.