HCard
Encyclopedia
hCard is a microformat
Microformat
A microformat is a web-based approach to semantic markup which seeks to re-use existing HTML/XHTML tags to convey metadata and other attributes in web pages and other contexts that support HTML, such as RSS...

 for publishing the contact details (which might be no more than the name) of people, companies, organizations, and places, in (X)HTML
HTML
HyperText Markup Language is the predominant markup language for web pages. HTML elements are the basic building-blocks of webpages....

, Atom
Atom (standard)
The name Atom applies to a pair of related standards. The Atom Syndication Format is an XML language used for web feeds, while the Atom Publishing Protocol is a simple HTTP-based protocol for creating and updating web resources.Web feeds allow software programs to check for updates published on a...

, RSS
RSS (file format)
RSS is a family of web feed formats used to publish frequently updated works—such as blog entries, news headlines, audio, and video—in a standardized format...

, or arbitrary XML
Extensible Markup Language
Extensible Markup Language is a set of rules for encoding documents in machine-readable form. It is defined in the XML 1.0 Specification produced by the W3C, and several other related specifications, all gratis open standards....

. The hCard microformat does this using a 1:1 representation of vCard
VCard
vCard is a file format standard for electronic business cards. vCards are often attached to e-mail messages, but can be exchanged in other ways, such as on the World Wide Web or Instant Messaging...

 (RFC
Request for Comments
In computer network engineering, a Request for Comments is a memorandum published by the Internet Engineering Task Force describing methods, behaviors, research, or innovations applicable to the working of the Internet and Internet-connected systems.Through the Internet Society, engineers and...

 2426) properties and values, identified using HTML classes and rel attributes
Rel attribute
A link relation is a descriptive attribute attached to a hyperlink in order to define the type of the link, or the relationship between the source and destination resources. The attribute can be used by automated systems, or can be presented to a user in a different way.In HTML these are designated...

.

It allows parsing tools (for example other websites, or Firefox's Operator extension
Operator (extension)
Operator is an extension for the Mozilla Firefox web browser. It parses and acts upon a number of microformats, as well as validating them.Operator lets the user access microformats through a number of methods, all of which are optional: a toolbar, a toolbar button, a status bar icon, a location...

) to extract the details, and display them, using some other websites or map
Map
A map is a visual representation of an area—a symbolic depiction highlighting relationships between elements of that space such as objects, regions, and themes....

ping tools, index or search them, or to load them into an address-book program.

In May 2009, Google
Google search
Google or Google Web Search is a web search engine owned by Google Inc. Google Search is the most-used search engine on the World Wide Web, receiving several hundred million queries each day through its various services....

 announced that they would be parsing the hCard, hReview
HReview
hReview is a microformat for publishing reviews of books, music, films, restaurants, businesses, holidays, etc. using HTML on web pages, using HTML classes and rel attributes.....

 and hProduct
HProduct
hProduct is a microformat for publishing details of products, on web pages, using HTML classes and rel attributes..On 12 May 2009, Google announced that they would be parsing the hProduct, hCard and hReview microformats, and using them to populate search result pages....

 microformats, and using them to populate search-result pages. In September 2010 Google
Google search
Google or Google Web Search is a web search engine owned by Google Inc. Google Search is the most-used search engine on the World Wide Web, receiving several hundred million queries each day through its various services....

 announced their intention to surface hCard, hReview
HReview
hReview is a microformat for publishing reviews of books, music, films, restaurants, businesses, holidays, etc. using HTML on web pages, using HTML classes and rel attributes.....

 information in their local search results. In February 2011, Facebook
Facebook
Facebook is a social networking service and website launched in February 2004, operated and privately owned by Facebook, Inc. , Facebook has more than 800 million active users. Users must register before using the site, after which they may create a personal profile, add other users as...

 began using hCard to mark up event venues.

Example

Consider the HTML:




With microformat markup, that becomes:



...

...



Here the formatted name (fn), organization (org), telephone number (tel) and web address (url) have been identified using specific class names; and the whole thing is wrapped in class="vcard" which indicate that the other classes form an hcard, and are not just coincidentally named. If the hCard is for an organisation or venue, the fn and org classes are used on the same element, as in Wikipedia or Wembley Stadium. Other, optional, hCard classes also exist.

It is now possible for software, for example browser plug-ins, to extract the information, and transfer it to other applications, such as an address book.

Geo and adr

The Geo microformat
Geo (microformat)
Geo is a microformat used for marking up WGS84 geographical coordinates in HTML. Although termed a "draft" specification, this is a formality, and the format is stable and in widespread use; not least as a sub-set of the published hCalendar and hCard microformat specifications, neither of which is...

 is a part of the hCard specification, and is often used to include the coordinates of a location within an hCard.

The adr part of hCard can also be used as a stand-alone microformat.

Live example

Here are the Wikimedia Foundation
Wikimedia Foundation
Wikimedia Foundation, Inc. is an American non-profit charitable organization headquartered in San Francisco, California, United States, and organized under the laws of the state of Florida, where it was initially based...

's contact details as of 2010-10-28, as a live hCard:





The mark-up (wrapped for clarity) used is:




Note that, in this example, the formal name (fn) and organisation (org) properties are combined on one element, indicating that this is the hCard for an organisation, not a person.

Other attributes

Other commonly used hCard attributes include
  • bday - a person's birth date
  • email
  • honorific-prefix
  • honorific-suffix
  • label - for non-granular addresses
  • logo
  • nickname
  • note - free text
  • photo
  • post-office-box

External links

The source of this article is wikipedia, the free encyclopedia.  The text of this article is licensed under the GFDL.
 
x
OK