[uf-discuss] Microformats and RDFa not as far apart as previously thought

Toby A Inkster mail at tobyinkster.co.uk
Sat Jun 28 16:51:46 PDT 2008


André Luís wrote:

> this extension would only work on xHTML, right? Or is it possible to
> use rdfa in html? (I'm not that proficient in rdfa)

The RDFa people have only specifically defined RDFa in terms of  
XHTML. This is for mostly pragmatic rather than ideological reasons -  
it was far easier to spec out that way. In practice, it was always  
expected that RDFa parsers would also support HTML, and indeed the  
majority do.

There are two pitfalls with adding RDFa to HTML:

1. It adds a few new attributes, plus allows a handful of existing  
attributes like 'rel', 'rev' and 'content' to be set on more elements  
than before. Any non-trivial RDFa will make use of these facilities,  
so can't be validated against the HTML 4.01 Strict DTD. It would  
probably be not much more than 20 minutes work to download a copy of  
the DTD, add these attributes in and get your HTML valid though.  
(Some people seem to have an irrational dislike for custom DTDs, so  
this solution may not be satisfactory to them.)

2. It also uses xmlns:X attributes, where X can be pretty much  
anything. Because DTDs don't allow wildcard attributes to be defined,  
you won't be able to create a DTD that can handle this. Again, use of  
xmlns:X is not required by RDFa, but any non-trivial page will  
probably need to. If you know that you're only going to be using a  
limited number of RDF vocabs, your DTD can however define those ones  
specifically (e.g. xmlns:dc for Dublin Core, xmlns:foaf for FOAF,  
etc). But in the general case, this is less easy to get around.

Although, it is beyond the scope of the RDFa spec, so is not likely  
to become official in the foreseeable future, I've proposed an  
alternative syntax for the xmlns:X stuff to be used in HTML -  
basically to use RFC 2731. (Which is what eRDF does.) I don't know  
how many parsers have implemented it, but Cognition includes support  
- http://buzzword.org.uk/cognition/

In short, if you're using the standard HTML 4.01 DTDs, RDFa will not  
validate. But it will work.

-- 
Toby A Inkster
<mailto:mail at tobyinkster.co.uk>
<http://tobyinkster.co.uk>






More information about the microformats-discuss mailing list