[uf-discuss] mime types and microformats

Ben Ward lists at ben-ward.co.uk
Thu Feb 1 07:58:17 PST 2007


On 1 Feb 2007, at 15:37, Rob O'Rourke wrote:
> If (x)HTML documents when served as text/html are treated as HTML  
> how are the microformats still working? Does this mean microformats  
> will work under an HTML 4.01 doctype?

Microformats are generally parsed absolutely fine in both XHTML and  
HTML, for one of two reasons:

• Some parsers (such as JavaScript bookmarklets) parse the HTMLDOM  
with script, after the browser has done its parsing so at that level,  
it makes no difference whether the document is HTML or XHTML.
• Other parsers (such as X2V) use an XSLT stylesheet to convert from  
XHTML into vcard or icalendar. These first run pages through a tool  
called Tidy, which converts HTML to well formed XHTML to allow the  
XSLT to run.

Basically, microformats are easier to parse directly if you use mark- 
up that validates as XML (the mime type doesn't make a difference in  
practice), but since open source tools exist that makes switching  
HTML into XHTML simple, real world parsing is very tolerant.

Ben


More information about the microformats-discuss mailing list