[uf-discuss] Coding mbox_sha1sum in XFN

Toby A Inkster mail at tobyinkster.co.uk
Sun Apr 27 02:43:20 PDT 2008


Julian Bond wrote:

> This looks like a generic problem. How to qualify an XFN entry with
> additional non-visible information.


Ah. Additional. In my earlier message I was assuming that you did not  
know (or want to show) an HTTP URL for the contact. That is, that you  
wanted to represent a person by their mbox_sha1sum *instead* of a  
conventional URL.

> <span class="mbox_sha1sum:fc521285feac8d1de0a488166aeeb9dbf99070e1">
> <a href="url" rel="contact">their name</a>
> <span>

That approach won't be picked up by any parsers that I know of. A  
better approach would be to look into RDFa or eRDF. Very few parsers  
though will handle both microformats and one of those. Cognition  
<http://buzzword.org.uk/cognition/> handles most microformats, plus  
eRDF *and* RDFa. Here's a code sample that uses hCard, XFN and RDFa  
(FOAF) and is correctly parsed by Cognition:

	<div class="vcard" id="alice"
	xmlns:foaf="http://xmlns.com/foaf/0.1/">
		<a class="fn url" rel="contact"
		about="#alice"
		property="foaf:mbox_sha1sum"
		content="fc521285feac8d1de0a488166aeeb9dbf99070e1"
		href="http://alice.example.net"
		>Alice Jones</a>
	</div>

Note that RDFa introduces a handful of extra attributes to HTML, so  
will not validate unless you use an RDFa DOCTYPE. (eRDF uses existing  
HTML attributes, but in my experience is often very likely to result  
in false positives for parsers when applying eRDF parsing to pages  
that were not authored from the ground up with eRDF in mind.)

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





More information about the microformats-discuss mailing list