[uf-discuss] Re: Nifty little hCalendar trick

Toby A Inkster mail at tobyinkster.co.uk
Mon Dec 1 06:04:53 PST 2008


On 1 Dec 2008, at 13:04, Toby A Inkster wrote:

> Type up the hCalendar:
>
> 	http://pastebin.com/m57fe450e
>
> (Yes, you need the surrounding <html>...</html> tags right now. I'm  
> working on a fix.)


OK, the reason for this is that Cognition (in the first instance)  
will attempt to parse a page as XHTML.

Of course, in XHTML, no elements can have their start or end tags  
omitted - i.e. <html> and <body> cannot be omitted - thus if your  
snippet starts with <div>, then <div> is the root element. Also, in  
XHTML, there is no class attribute on the root element. Put these  
together, and you get: if the snippet it parsed as if it were an  
XHTML document, the class attribute on the root element is ignored.

Solution: make sure that Cognition doesn't parse the snippet as  
XHTML, but as HTML instead. How? Easiest way is to leave out an  
optional end tag.

	http://pastebin.com/m12ebc0e8

Converts to:

	http://srv.buzzword.org.uk/icalendar/PB:m12ebc0e8

Nifty, nifty!

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





More information about the microformats-discuss mailing list