Difference between revisions of "hcard-brainstorming"

From Microformats Wiki
Jump to navigation Jump to search
(Application Implementation issues)
(Encoding/Decoding hCards setup for businesses)
Line 243: Line 243:
* MSN Instant Messenger, you can simple store "@hotmail.com" or "@msn.com" or "@passport.com" email addresses.
* MSN Instant Messenger, you can simple store "@hotmail.com" or "@msn.com" or "@passport.com" email addresses.
* Internet Relay Chat (IRC), use "irc:" URLs.
* Internet Relay Chat (IRC), use "irc:" URLs.
== Encoding Company data as a Business Card (proposal) ==
In the wild there are several hCards that do not currently validate because they are businesses that have omitted the "fn" property in favour of the "org" property.
# if there is an "fn" property use that value
# if the "fn" property is missing, but an "org" property is available, duplicate the value for both
# the "n" property is manditory, and must somehow be derived from "org", probably use the entire value as "family-name"
== CSS Styles ==
== CSS Styles ==

Revision as of 20:03, 19 August 2005




John Smith

FN:John Smith
org:Example Oragnization;Marketing and Communications
TITLE:Director, Marketing & Web Services
ADR;;123 Main Street;Any Town;MO;12345;USA
NOTE;quoted-printable:"A personal signature here"

This is one way to encode the vCard in HTML

<div class="vcard">
  <a href="mailto:john.smith@example.com">
   <span class="fn n">
    <span class="given-name">John</span>
    <span class="family-name">Smith</span>
  </a><br />

  <!-- need to encode CELL, FAX, WORK -->
  <span class="tel">314-123-4567</span><br />
  <span class="tel">314-123-4568</span><br />
  <span class="tel">314-123-4569</span><br />

<p>I work for
 <span class="org">
   <a href="http://www.example.com" class="organizational-name">Example Oragnization</a>
   in the <span class="organizational-unit">Marketing and Communications</span>
 department as <span class="title">Director, Marketing & Web Services</span>

  <span class="street">123 Main Street</span><br />
  <span class="locality">Any Town</span>,
  <span class="region">MO</span>
  <span class="postal-code">12345</span><br />
  <span class="country-name">USA</span><br />

<div class="note">A personal signature here</div>


This would display as:
John Smith

I work for Example Oragnization in the Marketing and Communications department as Director, Marketing & Web Services

123 Main Street
Any Town, MO 12345

A personal signature here

Baron von Münchhausen

N:Hieronymus;Karl;Friedrich;;Baron von Münchhausen;
FN:Karl Friedrich Hieronymus
NICKNAME:Baron von Münchhausen,The Baron of Lies,Freddy

This is one way to encode the vCard in HTML

<div class="vcard" xml:lang="de">
 <span class="n">
   <span class="fn">
    <span class="given-name">Karl</span>
    <span class="additional-names">Friedrich</span>
    <span class="family-name"><span class="sort-string">H</span>ieronymus</span>, 
   <span class="honorific-suffixes">Baron von Münchhausen</span>
 <ul class="nicknames">
   <li>Baron von Münchhausen</li>
   <li>The Baron of Lies</li>

This would display as:
Karl Friedrich Hieronymus, Baron von Münchhausen


  • Baron von Münchhausen
  • The Baron of Lies
  • Freddy

Examples from the RFC

These examples were taken from the vCard RFC 2426.

NOTE:This fax number is operational 0800 to 1715 EST\, Mon-Fri.

<div class="vcard">
<a href="mailto:jqpublic@xyz.dom1.com" class="email n">
  <span class="honorific-prefixes">Mr.</span> <span class="given-name">John</span> 
  <span class="additional-names">Quinlan</span> <span class="family-name">Public</span> 
  <span class="honorific-suffixes">Esq.</span>
<ul class="nickname">
<img src="http://www.example.com/pub/photos/jqpublic.gif" class="photo" />
<img src="http://www.example.com/pub/logos/abccorp.jpg" class="logo" />

<abbr title="1987-09-27T08:30:00-06:00" class="bday">Sept. 27th 1987</abbr>

<!-- Need to encode: TYPE=work,voice,pref,msg -->
<div class="tel">+1-213-555-1234</div>

<!-- I'm not sure this is accepted? -->
<abbr title="-050000" class="tz">Eastern Standard Time</abbr>

<ul class="categories">

<div class="note">This fax number is operational 0800 to 1715 EST\, Mon-Fri.</div>
<a href="http://www.swbyps.restaurant.french/~chezchic.html" class="url"></a>

FN:Frank Dawson
ORG:Lotus Development Corporation
ADR;TYPE=WORK,POSTAL,PARCEL:;;6544 Battleford Drive;Raleigh;NC;27613-3502;U.S.A.

<div class="vcard">
<a href="http://home.earthlink.net/~fdawson" class="url fn">Frank Dawson</a>
<div class="org">Lotus Development Corporation</div>

<!-- Need to encode WORK,POSTAL,PARCEL -->
<div class="adr">
  <span class="street-address">6544 Battleford Drive</span>
  <span class="locality">Raleigh</span>
  <span class="region">NC</span>
  <span class="postal-code">27613-3502</span>
  <span class="country-name">U.S.A.</span>

<!-- need to encode VOICE,MSG,WORK FAX -->
<div class="tel">+1-919-676-9515</div>
<div class="tel">+1-919-676-9564</div>

<!-- Need to encode PREF -->
<a class="email" href="mailto:Frank_Dawson@Lotus.com">Frank_Dawson@Lotus.com</a>
<a class="email" href="mailto:fdawson@earthlink.net">fdawson@earthlink.net</a>

FN:Tim Howes
ORG:Netscape Communications Corp.
ADR;TYPE=WORK:;;501 E. Middlefield Rd.;Mountain View;CA; 94043;U.S.A.

<div class="vcard">
<a href="mailto:howes@netscape.com" class="fn email">Tim Howes</a>
<div class="org">Netscape Communications Corp.</div>

<!-- Need to encode WORK -->
<div class="adr">
  <span class="street-address">501 E. Middlefield Rd</span>
  <span class="locality">Mountain View</span>
  <span class="region">CA</span>
  <span class="postal-code">94043</span>
  <span class="country-name">U.S.A.</span>

<!-- need to encode VOICE,MSG,WORK FAX -->
<div class="tel">+1-415-937-3419</div>
<div class="tel">+1-415-528-4164</div>


Encoding "modern" attributes

Since vCard was first established, various interactive communication technologies and addressing schemes have been widely adopted. Although there aren't specific properties for these technologies / addressing schemes, they can be captured as URLs or email addresses as follows:

  • AOL Instant Messenger (AIM) ids, simply store "aim:goim?screenname=" urls, e.g.
    • <a class="url" href="aim:goim?screenname=yournamehere">...
  • iChat mac.com addresses, simply store "@mac.com" email addresses, e.g.
  • MSN Instant Messenger, you can simple store "@hotmail.com" or "@msn.com" or "@passport.com" email addresses.
  • Internet Relay Chat (IRC), use "irc:" URLs.

Encoding Company data as a Business Card (proposal)

In the wild there are several hCards that do not currently validate because they are businesses that have omitted the "fn" property in favour of the "org" property.

  1. if there is an "fn" property use that value
  2. if the "fn" property is missing, but an "org" property is available, duplicate the value for both
  3. the "n" property is manditory, and must somehow be derived from "org", probably use the entire value as "family-name"

CSS Styles

Not only can you create semantics with the hCard values, but you can add CSS styles to them as well. You are free to style the terms in any way you want, but here we can list a few ideas for how to style terms.

If you want to encode hCard data, but do NOT want to display it in the HTML code, then you can hide that tag in CSS with the following code:

<span style="display: none">Hidden Data</span>

Transforming applications will still find the data and use it when converting hCards to vCards.


There is currently a debate over the best way to add an auto discovery link to your HTML to extract the vCard.

On the page with the hCard encoding, the best link would be as follows: <link rel="alternate" type="text/vcard" href="..." /> this HTML page is an alternate view of the vCard.

When on a different page, referencing that encoded page in the href would NOT be an alternate view of the current page. So a different rel type must be established to decribe that relationship. The ideas vary from specific to vague. The list and categories follow:


Example of mixing two rel types to a single page. rel="hcard xfn"

NOTE: this one is probably ruled out because you could assume you are linking directly to a vCard, which is not true. rel="vcard"

Auto-Discovery for XFN

An author will typically their XFN information on a specific page, rather than all pages. In particular, a specific page separate from the home page of their blog, and thus it would be useful to have an explicit rel value to assist in auto-discovery of XFN information.

This was suggested by Jens Alfke on 20050606 at the WWDC blogger's dinner.

Issues with vCard Applications

The following are major vCard application and a description of the features they support and don't support.

Apple Address Book

  • There are issues with importing UTF-8 vCards
  • LOGO property is not supported
  • only ONE URL is supported
  • PHOTO property can only be encoded, no URL references allowed
  • SOURCE property is not supported

Windows Address Book

(not yest tested)

Mozilla Thunderbird

(not yest tested)


(not yest tested)

Open Questions

Q: since many of the components would be using CSS classes for encoding data, it is possible to MIX two different profiles. (e.g. hCard and XFN) There are no real constraints on where/how to enforce class names, these are based on the html profile, since it is difficult to associate the text within the attribute to a specific profile.

<a href="mailto:joe.smith@example.com" class="fn" rel="met">Joe Smith</a>

-- Brian Suda

Q: Preserving White space? Should the transforming applications preserve extra white space characters? For example:

<a href="http://mywebsite.com/" class="fn n">
    <span class="given-name">John</span>
    <span class="other-names">Q.</span>
    <span class="family-name">Public</span>

When transformed into a vCard, the N property will pick apart the span tags and create the value for N correctly seperated by colons. The FN property will take a string and simply display it. There are two possible renderings for FN:

John Q. Public


Either the white-space is preserved or it is not. Which should the transforming applications render?

-- Brian Suda

A: The parsing application should follow the white space collapsing rules of the mime type it retrieves. I.e. if it retrieves a "text/html" document, it should do HTML white space collapsing.

-- Tantek

Many of the Questions and Answers are relevant to both ["hCal"] and hCard.

Q: Would it be appropriate to wrap the name of the vCard owner with ? This may give the hCard some added semantic value in the XHTML document.

<span class="agent"> 
 <span class="vcard">
  <span class="email">
   <a class="internet" href="mailto:jfriday@host.com">
       <span class="fn">Joe Friday</span>
  <span class="tel">+1-919-555-7878</span>
  <span class="title">Area Administrator, Assistant</span>

-- Ben Ward


Applications that are hCard aware or can convert hCard to vCard formats.

Copy hCards favelet(s)

  • I think a Favelet would work nicely here. When you find a page that is hCard friendly, you click the favlet and you get yourself a vCard. This is done! See X2V in the implementations section of the hCard spec.

Distributed Commentor Icons

  • See using hCards in your blog for an example of hCards used for comment authors (commentors). The system used there, "Gravatars", is a centralized site that serves commentor icons that requires login etc.

What if we gave each commentor the option of hosting their own icon?

A distributed commentor icon implementation could work like this:

  1. Given the URL of a commentor, look for an <address> element with classname of "vcard" at the commentor's URL. The <address> element is supposed to be the contact information for the page (see hCard FAQ for more info), so this makes sense.
  2. Next, look for the first element inside that hcard that has a classname of "logo".
  3. Hopefully that element is an <img>, and if so, use its src to get the commentor's icon.
  4. Presto. You've got distributed commentor icons!

Spam prevention

hCard uses mailto: links, and therefore it automatically "inherits" the disadvantage of mailto: links: These links can be easily detected by emails spiders (used by spammers).

There are ways to prevent email address detection by simple email spiders, while still retaining full compatibility with (X)HTML applications. One common way is to "encode" the the "m" of "mail" and "@" with character entities:

Example of the original link:

<a class="email" href="mailto:john.smith@example.com">john.smith@example.com</a> 

Example of the "encoded" link:

<a class="e&#109;ail" href="&#109;ailto:john.smith&#064;example.com">john.smith&#064;example.com</a>

Simple email spiders which do not do character entity decoding will therefore not be able to find your email address.

Note: Perhaps there are or will be email spiders which can decode entities, so the this technique will only help with some (cheap) email spiders. (See also: http://rbach.priv.at/Misc/2005/EmailSpiderTest)


How to hCard encode entries in Popular blog software.


See separate hCard parsing page.


  • The hCard Profile needs verification and perhaps a URL for retrieving the actual XMDP, rather than as <pre> text on a wiki page.
  • Complete translating the examples from the vCard spec into hCard, and place them on a separate hCard examples page.
  • Create a "rich" but realistic hCard example, say for example for a salesperson, who wants to put a whole bunch of contact information on their website in order to be found/contacted easily.
  • Provide examples of how to encode instant messaging (IM) accounts. Figure out what would the mailto: or aim: URL in hCard look like in vCard. And take a look at what vCard applications do today with IM addresses.


Normative References

Informative References

Other Implementations/Ideas

  • Representing vCard Objects in RDF/XML This could allow conversion of vCard data from XHTML to RDF and from RDF to XHTML
  • It would also be possible to convert XFN and hCard to FoaF and back.

Rejected Suggestions

Suggestion: The use of class="url" on an <a> tag to represent an hCard URL property is redundant. By virtue of the <a> tag you know this is a URL.

Rejected. This is a bad suggestion because although it appears to reduce redunancy and keep things cleaner, it also creates a few problems. Without explicitly noting that this is a URL then any <a> tags within a 'vcard' would be considered a URL, for example:

<span class="vcard">
<ul class="categories">
<li><a href="http://w3c.org">W3C</a></li>

There is no way to "turn-off" the encoding of the W3C URL, whereas if "url" needed to be explicitly listed in the class attribute list, then by NOT listing it you could effectively turn it off.