[microformats-discuss] A 10 line script to identify and process any microformat

Ryan King ryan at technorati.com
Thu Jul 28 19:56:58 PDT 2005


On Jul 28, 2005, at 5:48 PM, Alf Eaton wrote:
> The problem with all of these approaches is that once you want to  
> parse or extract more than one microformat, you have to check each  
> element of the page for each of a big list of possible classnames.  
> I'd like to propose, therefore (and maybe it's been proposed before),

It has.

> that each microformat should have one common classname:  
> 'microdata', say.

This has been proposed before and rejected for several reasons:

1. We're optimizing for publishers, not consumers. Yes, parsing  
microformats is *hard* and no one is claiming its easy.
2. This seems like needless complexity. Though its tough, you can get  
the data out.
3. A universal parsing  apparatus is not possible. You could probably  
get a system that's pretty flexible and can handle a good number of  
formats, but you will not likely be able to create something with  
unlimited abilities.
4. What happens when everyone's using microformats everywhere? :D

> Then the main selector can be
> var mc = document.evaluate(//*[contains(@class,'microdata')]",  
> document, null, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null);
> and you only have to check the big list of possible classnames  
> against that one node.
>
> For example, <div class="microdata xfolkentry"> or <div  
> class="microdata hreview"> .

BTW, this is probably a good discussion to have on the microformats- 
discuss list.

As you may know (or may not), the dev list is not open subscription,  
but is limited to people who have a microformat implementation.  
Having said that, if you think you belong on the dev list, feel free  
to speak up (not on the list, though, email me directly).

-ryan


More information about the microformats-discuss mailing list