W3C

Microdata vocabularies: vCard

Editor's Draft 27 October 2009

Latest Published Version:
http://www.w3.org/TR/mdvcard/
Latest Editor's Draft:
http://dev.w3.org/html5/mdvcard/
Editor:
Ian Hickson, Google, Inc.

Abstract

This specification defines a microdata vocabulary (an item type and associated defined property names) for contact information, based on the vCard format.

Status of this document

This section describes the status of this document at the time of its publication. Other documents may supersede this document. A list of current W3C publications and the most recently formally published revision of this technical report can be found in the W3C technical reports index at http://www.w3.org/TR/.

If you wish to make comments regarding this document, please send them to public-html-comments@w3.org (subscribe, archives) or whatwg@whatwg.org (subscribe, archives), or submit them using our public bug database. All feedback is welcome.

The working groups maintains a list of all bug reports that the editor has not yet tried to address and a list of issues for which the chairs have not yet declared a decision. The editor also maintains a list of all e-mails that he has not yet tried to address.

Implementors should be aware that this specification is not stable. Implementors who are not taking part in the discussions are likely to find the specification changing out from under them in incompatible ways. Vendors interested in implementing this specification before it eventually reaches the Candidate Recommendation stage should join the aforementioned mailing lists and take part in the discussions.

The publication of this document by the W3C as a W3C Working Draft does not imply that all of the participants in the W3C HTML working group endorse the contents of the specification. Indeed, for any section of the specification, one can usually find many members of the working group or of the W3C as a whole who object strongly to the current text, the existence of the section at all, or the idea that the working group should even spend time discussing the concept of that section.

The latest stable version of the editor's draft of this specification is always available on the W3C CVS server and in the WHATWG Subversion repository. The latest editor's working copy (which may contain unfinished text in the process of being prepared) is also available.

There are various ways to follow the change history for the specification:

E-mail notifications of changes
HTML-Diffs mailing list (diff-marked HTML versions for each change): http://lists.w3.org/Archives/Public/public-html-diffs/latest
Commit-Watchers mailing list (complete source diffs): http://lists.whatwg.org/listinfo.cgi/commit-watchers-whatwg.org
Real-time notifications of changes:
Generated diff-marked HTML versions for each change: http://twitter.com/HTML5
All (non-editorial) changes to the spec source: http://twitter.com/WHATWG
Browsable version-control record of all changes:
CVSWeb interface with side-by-side diffs: http://dev.w3.org/cvsweb/html5/spec/Overview.html
Annotated summary with unified diffs: http://html5.org/tools/web-apps-tracker
Raw Subversion interface: svn checkout http://svn.whatwg.org/webapps/

The W3C HTML Working Group is the W3C working group responsible for this specification's progress along the W3C Recommendation track. This specification is the 27 October 2009 Editor's Draft.

The text of this specification is also available as part of the WHATWG's Microdata Vocabularies specification, in its vCard section. This normative content of this specification and the vCard section of the WHATWG specification are identical.

This specification is intended to define vocabularies for HTML5's Microdata feature to address the most important use cases for which Microdata was created. It is specified independently to allow the Microdata vocabularies to evolve independently of the HTML5 specification itself.

This document was produced by a group operating under the 5 February 2004 W3C Patent Policy. W3C maintains a public list of any patent disclosures made in connection with the deliverables of the group; that page also includes instructions for disclosing a patent. An individual who has actual knowledge of a patent which the individual believes contains Essential Claim(s) must disclose the information in accordance with section 6 of the W3C Patent Policy.

Table of contents

  1. 1 The vocabulary
  2. 2 Conversion to vCard
  3. 3 Examples
  4. References

1 The vocabulary

This section defines a microdata vocabulary. [HTML5]

An item with the item type http://microformats.org/profile/hcard represents a person's or organization's contact information.

This vocabulary supports global identifiers for items.

The following are the type's defined property names. They are based on the vocabulary defined in the vCard specification and its extensions, where more information on how to interpret the values can be found. [RFC2426] [RFC4770]

fn

Gives the formatted text corresponding to the name of the person or organization.

The value must be text.

Exactly one property with the name fn must be present within each item with the type http://microformats.org/profile/hcard.

n

Gives the structured name of the person or organization.

The value must be an item with zero or more of each of the family-name, given-name, additional-name, honorific-prefix, and honorific-suffix properties.

Except when one of the conditions given below applies, exactly one property with the name n must be present within each item with the type http://microformats.org/profile/hcard.

If one of the following conditions does apply, then the n may be omitted:

The item with the type vcard has both an fn property and an org property, and they both have values that are strings and those strings are identical when compared in a case-sensitive manner.

The contact information must be for an organization.

The item with the type vcard has an fn property whose value consists of a string with zero space characters.

The value of the fn property must be a nickname.

The item with the type vcard has an fn property whose value consists of a string with exactly one sequence of space characters, which occurs neither at the immediate start nor the immediate end of the string.

The value of the fn property must be a name in one of the following forms:

  • Last, First
  • Last F.
  • Last F
  • First Last
family-name (inside n)

Gives the family name of the person, or the full name of the organization.

The value must be text.

Any number of properties with the name family-name may be present within the item that forms the value of the n property of an item with the type http://microformats.org/profile/hcard.

given-name (inside n)

Gives the given-name of the person.

The value must be text.

Any number of properties with the name given-name may be present within the item that forms the value of the n property of an item with the type http://microformats.org/profile/hcard.

additional-name (inside n)

Gives the any additional names of the person.

The value must be text.

Any number of properties with the name additional-name may be present within the item that forms the value of the n property of an item with the type http://microformats.org/profile/hcard.

honorific-prefix (inside n)

Gives the honorific prefix of the person.

The value must be text.

Any number of properties with the name honorific-prefix may be present within the item that forms the value of the n property of an item with the type http://microformats.org/profile/hcard.

honorific-suffix (inside n)

Gives the honorific suffix of the person.

The value must be text.

Any number of properties with the name honorific-suffix may be present within the item that forms the value of the n property of an item with the type http://microformats.org/profile/hcard.

nickname

Gives the nickname of the person or organization.

The nickname is the descriptive name given instead of or in addition to the one belonging to a person, place, or thing. It can also be used to specify a familiar form of a proper name specified by the fn or n properties.

The value must be text.

Any number of properties with the name nickname may be present within each item with the type http://microformats.org/profile/hcard.

photo

Gives a photograph of the person or organization.

The value must be an absolute URL.

Any number of properties with the name photo may be present within each item with the type http://microformats.org/profile/hcard.

bday

Gives the birth date of the person or organization.

The value must be a valid date string.

A single property with the name bday may be present within each item with the type http://microformats.org/profile/hcard.

adr

Gives the delivery address of the person or organization.

The value must be an item with zero or more type, post-office-box, extended-address, and street-address properties, and optionally a locality property, optionally a region property, optionally a postal-code property, and optionally a country-name property.

If no type properties are present within an item that forms the value of an adr property of an item with the type http://microformats.org/profile/hcard, then the address type strings intl, postal, parcel, and work are implied.

Any number of properties with the name adr may be present within each item with the type http://microformats.org/profile/hcard.

type (inside adr)

Gives the type of delivery address.

The value must be text that, when compared in a case-sensitive manner, is equal to one of the address type strings.

Within each item with the type http://microformats.org/profile/hcard, there must be no more than one adr property item with a type property whose value is pref.

Any number of properties with the name type may be present within the item that forms the value of an adr property of an item with the type http://microformats.org/profile/hcard, but within each such adr property item there must only be one type property per distinct value.

post-office-box (inside adr)

Gives the post office box component of the delivery address of the person or organization.

The value must be text.

Any number of properties with the name post-office-box may be present within the item that forms the value of an adr property of an item with the type http://microformats.org/profile/hcard.

extended-address (inside adr)

Gives an additional component of the delivery address of the person or organization.

The value must be text.

Any number of properties with the name extended-address may be present within the item that forms the value of an adr property of an item with the type http://microformats.org/profile/hcard.

street-address (inside adr)

Gives the street address component of the delivery address of the person or organization.

The value must be text.

Any number of properties with the name street-address may be present within the item that forms the value of an adr property of an item with the type http://microformats.org/profile/hcard.

locality (inside adr)

Gives the locality component (e.g. city) of the delivery address of the person or organization.

The value must be text.

A single property with the name locality may be present within the item that forms the value of an adr property of an item with the type http://microformats.org/profile/hcard.

region (inside adr)

Gives the region component (e.g. state or province) of the delivery address of the person or organization.

The value must be text.

A single property with the name region may be present within the item that forms the value of an adr property of an item with the type http://microformats.org/profile/hcard.

postal-code (inside adr)

Gives the postal code component of the delivery address of the person or organization.

The value must be text.

A single property with the name postal-code may be present within the item that forms the value of an adr property of an item with the type http://microformats.org/profile/hcard.

country-name (inside adr)

Gives the country name component of the delivery address of the person or organization.

The value must be text.

A single property with the name country-name may be present within the item that forms the value of an adr property of an item with the type http://microformats.org/profile/hcard.

label

Gives the formatted text corresponding to the delivery address of the person or organization.

The value must be either text or an item with zero or more type properties and exactly one value property.

If no type properties are present within an item that forms the value of a label property of an item with the type http://microformats.org/profile/hcard, or if the value of such a label property is text, then the address type strings intl, postal, parcel, and work are implied.

Any number of properties with the name label may be present within each item with the type http://microformats.org/profile/hcard.

type (inside label)

Gives the type of delivery address.

The value must be text that, when compared in a case-sensitive manner, is equal to one of the address type strings.

Within each item with the type http://microformats.org/profile/hcard, there must be no more than one label property item with a type property whose value is pref.

Any number of properties with the name type may be present within the item that forms the value of a label property of an item with the type http://microformats.org/profile/hcard, but within each such label property item there must only be one type property per distinct value.

value (inside label)

Gives the actual formatted text corresponding to the delivery address of the person or organization.

The value must be text.

Exactly one property with the name value must be present within the item that forms the value of a label property of an item with the type http://microformats.org/profile/hcard.

tel

Gives the telephone number of the person or organization.

The value must be either text that can be interpreted as a telephone number as defined in the CCITT specifications E.163 and X.121, or an item with zero or more type properties and exactly one value property. [E163] [X121]

If no type properties are present within an item that forms the value of a tel property of an item with the type http://microformats.org/profile/hcard, or if the value of such a tel property is text, then the telephone type string voice is implied.

Any number of properties with the name tel may be present within each item with the type http://microformats.org/profile/hcard.

type (inside tel)

Gives the type of telephone number.

The value must be text that, when compared in a case-sensitive manner, is equal to one of the telephone type strings.

Within each item with the type http://microformats.org/profile/hcard, there must be no more than one tel property item with a type property whose value is pref.

Any number of properties with the name type may be present within the item that forms the value of a tel property of an item with the type http://microformats.org/profile/hcard, but within each such tel property item there must only be one type property per distinct value.

value (inside tel)

Gives the actual telephone number of the person or organization.

The value must be text that can be interpreted as a telephone number as defined in the CCITT specifications E.163 and X.121. [E163] [X121]

Exactly one property with the name value must be present within the item that forms the value of a tel property of an item with the type http://microformats.org/profile/hcard.

email

Gives the e-mail address of the person or organization.

The value must be either text or an item with zero or more type properties and exactly one value property.

If no type properties are present within an item that forms the value of an email property of an item with the type http://microformats.org/profile/hcard, or if the value of such an email property is text, then the e-mail type string internet is implied.

Any number of properties with the name email may be present within each item with the type http://microformats.org/profile/hcard.

type (inside email)

Gives the type of e-mail address.

The value must be text that, when compared in a case-sensitive manner, is equal to one of the e-mail type strings.

Within each item with the type http://microformats.org/profile/hcard, there must be no more than one email property item with a type property whose value is pref.

Any number of properties with the name type may be present within the item that forms the value of an email property of an item with the type http://microformats.org/profile/hcard, but within each such email property item there must only be one type property per distinct value.

value (inside email)

Gives the actual e-mail address of the person or organization.

The value must be text.

Exactly one property with the name value must be present within the item that forms the value of an email property of an item with the type http://microformats.org/profile/hcard.

mailer

Gives the name of the e-mail software used by the person or organization.

The value must be text.

Any number of properties with the name mailer may be present within each item with the type http://microformats.org/profile/hcard.

tz

Gives the time zone of the person or organization.

The value must be text and must match the following syntax:

  1. Either a U+002B PLUS SIGN character (+) or a U+002D HYPHEN-MINUS character (-).
  2. A valid non-negative integer that is exactly two digits long and that represents a number in the range 00..23.
  3. A U+003A COLON character (:).
  4. A valid non-negative integer that is exactly two digits long and that represents a number in the range 00..59.

Any number of properties with the name tz may be present within each item with the type http://microformats.org/profile/hcard.

geo

Gives the geographical position of the person or organization.

The value must be text and must match the following syntax:

  1. Optionally, either a U+002B PLUS SIGN character (+) or a U+002D HYPHEN-MINUS character (-).
  2. One or more digits in the range U+0030 DIGIT ZERO (0) to U+0039 DIGIT NINE (9).
  3. Optionally*, a U+002E FULL STOP character (.) followed by one or more digits in the range U+0030 DIGIT ZERO (0) to U+0039 DIGIT NINE (9).
  4. A U+003B SEMICOLON character (;).
  5. Optionally, either a U+002B PLUS SIGN character (+) or a U+002D HYPHEN-MINUS character (-).
  6. One or more digits in the range U+0030 DIGIT ZERO (0) to U+0039 DIGIT NINE (9).
  7. Optionally*, a U+002E FULL STOP character (.) followed by one or more digits in the range U+0030 DIGIT ZERO (0) to U+0039 DIGIT NINE (9).

The optional components marked with an asterisk (*) should be included, and should have six digits each.

The value specifies latitude and longitude, in that order (i.e., "LAT LON" ordering), in decimal degrees. The longitude represents the location east and west of the prime meridian as a positive or negative real number, respectively. The latitude represents the location north and south of the equator as a positive or negative real number, respectively.

Any number of properties with the name geo may be present within each item with the type http://microformats.org/profile/hcard.

title

Gives the job title, functional position or function of the person or organization.

The value must be text.

Any number of properties with the name title may be present within each item with the type http://microformats.org/profile/hcard.

role

Gives the role, occupation, or business category of the person or organization.

The value must be text.

Any number of properties with the name role may be present within each item with the type http://microformats.org/profile/hcard.

Gives the logo of the person or organization.

The value must be an absolute URL.

Any number of properties with the name logo may be present within each item with the type http://microformats.org/profile/hcard.

agent

Gives the contact information of another person who will act on behalf of the person or organization.

The value must be either an item with the type http://microformats.org/profile/hcard, or an absolute URL, or text.

Any number of properties with the name logo may be present within each item with the type http://microformats.org/profile/hcard.

org

Gives the name and units of the organization.

The value must be either text or an item with one organization-name property and zero or more organization-unit properties.

Any number of properties with the name org may be present within each item with the type http://microformats.org/profile/hcard.

organization-name (inside org)

Gives the name of the organization.

The value must be text.

Exactly one property with the name organization-name must be present within the item that forms the value of an org property of an item with the type http://microformats.org/profile/hcard.

organization-unit (inside org)

Gives the name of the organization unit.

The value must be text.

Any number of properties with the name organization-unit may be present within the item that forms the value of the org property of an item with the type http://microformats.org/profile/hcard.

categories

Gives the name of a category or tag that the person or organization could be classified as.

The value must be text.

Any number of properties with the name categories may be present within each item with the type http://microformats.org/profile/hcard.

note

Gives supplemental information or a comment about the person or organization.

The value must be text.

Any number of properties with the name note may be present within each item with the type http://microformats.org/profile/hcard.

rev

Gives the revision date and time of the contact information.

The value must be text that is a valid global date and time string.

The value distinguishes the current revision of the information for other renditions of the information.

Any number of properties with the name rev may be present within each item with the type http://microformats.org/profile/hcard.

sort-string

Gives the string to be used for sorting the person or organization.

The value must be text.

Any number of properties with the name sort-string may be present within each item with the type http://microformats.org/profile/hcard.

sound

Gives a sound file relating to the person or organization.

The value must be an absolute URL.

Any number of properties with the name sound may be present within each item with the type http://microformats.org/profile/hcard.

url

Gives a URL relating to the person or organization.

The value must be an absolute URL.

Any number of properties with the name url may be present within each item with the type http://microformats.org/profile/hcard.

class

Gives the access classification of the information regarding the person or organization.

The value must be text with one of the following values:

This is merely advisory and cannot be considered a confidentiality measure.

Any number of properties with the name class may be present within each item with the type http://microformats.org/profile/hcard.

impp

Gives a URL for instant messaging and presence protocol communications with the person or organization.

The value must be either an absolute URL or an item with zero or more type properties and exactly one value property.

If no type properties are present within an item that forms the value of an impp property of an item with the type http://microformats.org/profile/hcard, or if the value of such an impp property is an absolute URL, then no IMPP type strings are implied.

Any number of properties with the name impp may be present within each item with the type http://microformats.org/profile/hcard.

type (inside impp)

Gives the intended use of the IMPP URL.

The value must be text that, when compared in a case-sensitive manner, is equal to one of the IMPP type strings.

Within each item with the type http://microformats.org/profile/hcard, there must be no more than one impp property item with a type property whose value is pref.

Any number of properties with the name type may be present within the item that forms the value of an impp property of an item with the type http://microformats.org/profile/hcard, but within each such impp property item there must only be one type property per distinct value.

value (inside impp)

Gives the actual URL for instant messaging and presence protocol communications with the person or organization.

The value must be an absolute URL.

Exactly one property with the name value must be present within the item that forms the value of an impp property of an item with the type http://microformats.org/profile/hcard.

The address type strings are:

dom

Indicates a domestic delivery address.

intl

Indicates an international delivery address.

postal

Indicates a postal delivery address.

parcel

Indicates a parcel delivery address.

home

Indicates a residential delivery address.

work

Indicates a delivery address for a place of work.

pref

Indicates the preferred delivery address when multiple addresses are specified.

The telephone type strings are:

home

Indicates a residential number.

msg

Indicates a telephone number with voice messaging support.

work

Indicates a telephone number for a place of work.

voice

Indicates a voice telephone number.

fax

Indicates a facsimile telephone number.

cell

Indicates a cellular telephone number.

video

Indicates a video conferencing telephone number.

pager

Indicates a paging device telephone number.

bbs

Indicates a bulletin board system telephone number.

modem

Indicates a MODEM-connected telephone number.

car

Indicates a car-phone telephone number.

isdn

Indicates an ISDN service telephone number.

pcs

Indicates a personal communication services telephone number.

pref

Indicates the preferred telephone number when multiple telephone numbers are specified.

The e-mail type strings are:

internet

Indicates an Internet e-mail address.

x400

Indicates a X.400 addressing type.

pref

Indicates the preferred e-mail address when multiple e-mail addresses are specified.

The IMPP type strings are:

personal
business

Indicates the type of communication for which this IMPP URL is appropriate.

home
work
mobile

Indicates the location of a device associated with this IMPP URL.

pref

Indicates the preferred address when multiple IMPP URLs are specified.

2 Conversion to vCard

Given a list of nodes nodes in a Document, a user agent must run the following algorithm to extract any vCard data represented by those nodes (only the first vCard is returned):

  1. If none of the nodes in nodes are items with the item type http://microformats.org/profile/hcard, then there is no vCard. Abort the algorithm, returning nothing.

  2. Let node be the first node in nodes that is an item with the item type http://microformats.org/profile/hcard.

  3. Let output be an empty string.

  4. Add a vCard line with the type "BEGIN" and the value "VCARD" to output.

  5. Add a vCard line with the type "PROFILE" and the value "VCARD" to output.

  6. Add a vCard line with the type "VERSION" and the value "3.0" to output.

  7. Add a vCard line with the type "SOURCE" and the result of escaping the vCard text string that is the the document's current address as the value to output.

  8. If the title element is not null, add a vCard line with the type "NAME" and with the result of escaping the vCard text string obtained from the textContent of the title element as the value to output.

  9. If node has a global identifier, add a vCard line with the type "UID" and with the result of escaping the vCard text string of that global identifier as the value to output.

  10. Let first-n, first-org, and first-fn be null.

  11. For each element element that is a property of the item node: for each name name in element's property names, run the following substeps:

    1. Let parameters be an empty set of name-value pairs.

    2. Run the appropriate set of substeps from the following list. The steps will set a variable value, which is used in the next step.

      If the property's value is an item subitem and name is n
      1. If first-n is null, let first-n be element.

      2. Let n1 be the value of the first property named family-name in subitem, or the empty string if there is no such property or the property's value is itself an item.

      3. Let n2 be the value of the first property named given-name in subitem, or the empty string if there is no such property or the property's value is itself an item.

      4. Let n3 be the value of the first property named additional-name in subitem, or the empty string if there is no such property or the property's value is itself an item.

      5. Let n4 be the value of the first property named honorific-prefix in subitem, or the empty string if there is no such property or the property's value is itself an item.

      6. Let n5 be the value of the first property named honorific-suffix in subitem, or the empty string if there is no such property or the property's value is itself an item.

      7. Let value be the concatenation of the following, in this order:

        1. The result of escaping the vCard text string n1
        2. A U+003B SEMICOLON character (;)
        3. The result of escaping the vCard text string n2
        4. A U+003B SEMICOLON character (;)
        5. The result of escaping the vCard text string n3
        6. A U+003B SEMICOLON character (;)
        7. The result of escaping the vCard text string n4
        8. A U+003B SEMICOLON character (;)
        9. The result of escaping the vCard text string n5
      If the property's value is an item subitem and name is adr
      1. Let value be the empty string.

      2. Append to value the result of collecting vCard subproperties named post-office-box in subitem.

      3. Append a U+003B SEMICOLON character (;) to value.
      4. Append to value the result of collecting vCard subproperties named extended-address in subitem.

      5. Append a U+003B SEMICOLON character (;) to value.
      6. Append to value the result of collecting vCard subproperties named street-address in subitem.

      7. Append a U+003B SEMICOLON character (;) to value.
      8. Append to value the result of collecting the first vCard subproperty named locality in subitem.

      9. Append a U+003B SEMICOLON character (;) to value.
      10. Append to value the result of collecting the first vCard subproperty named region in subitem.

      11. Append a U+003B SEMICOLON character (;) to value.
      12. Append to value the result of collecting the first vCard subproperty named postal-code in subitem.

      13. Append a U+003B SEMICOLON character (;) to value.
      14. Append to value the result of collecting the first vCard subproperty named country-name in subitem.

      15. If there is a property named type in subitem, and the first such property has a value that is not an item and whose value consists only of alphanumeric ASCII characters, then add a parameter named "TYPE" whose value is the value of that property to parameters.

      If the property's value is an item subitem and name is org
      1. If first-org is null, let first-org be element.

      2. Let value be the empty string.

      3. Append to value the result of collecting the first vCard subproperty named organization-name in subitem.

      4. For each property named organization-unit in subitem, run the following steps:

        1. If the value of the property is an item, then skip this property.

        2. Append a U+003B SEMICOLON character (;) to value.

        3. Append the result of escaping the vCard text string given by the value of the property to value.

      If the property's value is an item subitem with the item type http://microformats.org/profile/hcard and name is agent
      1. Let value be the result of escaping the vCard text string obtained from extracting a vCard from the element that represents subitem.

      2. Add a parameter named "VALUE" whose value is "VCARD" to parameters.

      If the property's value is an item and name is none of the above
      1. Let value the result of collecting the first vCard subproperty named value in subitem.

      2. If there is a property named type in subitem, and the first such property has a value that is not an item and whose value consists only of alphanumeric ASCII characters, then add a parameter named "TYPE" whose value is the value of that property to parameters.

      Otherwise (the property's value is not an item)
      1. If name is fn and first-fn is null, let first-fn be element.

        Otherwise, if name is org and first-org is null, let first-org be element.

      2. Let value be the property's value.

      3. If element is one of the URL property elements, add a parameter with the name "VALUE" and the value "URI" to parameters.

      4. Otherwise, if element is a time element and the value is a valid date string, add a parameter with the name "VALUE" and the value "DATE" to parameters.

      5. Otherwise, if element is a time element and the value is a valid global date and time string, add a parameter with the name "VALUE" and the value "DATE-TIME" to parameters.

      6. Prefix every U+005C REVERSE SOLIDUS character (\) in value with another U+005C REVERSE SOLIDUS character (\).

      7. Prefix every U+002C COMMA character (,) in value with a U+005C REVERSE SOLIDUS character (\).

      8. Unless name is geo, prefix every U+003B SEMICOLON character (;) in value with a U+005C REVERSE SOLIDUS character (\).

      9. Replace every U+000D CARRIAGE RETURN U+000A LINE FEED character pair (CRLF) in value with a U+005C REVERSE SOLIDUS character (\) followed by a U+006E LATIN SMALL LETTER N character (n).

      10. Replace every remaining U+000D CARRIAGE RETURN (CR) or U+000A LINE FEED (LF) character in value with a U+005C REVERSE SOLIDUS character (\) followed by a U+006E LATIN SMALL LETTER N character (n).

    3. Add a vCard line with the type name, the parameters parameters, and the value value to output.

  12. If first-n is null, then run the following substeps:

    1. If first-fn is also null, then skip the remainder of these substeps.

    2. If first-fn has a value that is an item, then skip the remainder of these substeps.

    3. If first-org is not null, and the value of first-org is not an item and is equal to first-fn, then add a vCard line with the type "N" whose value is four U+003B SEMICOLON characters (";;;;") to output. Then, skip the remainder of these substeps.

    4. If the space characters in first-fn, if any, are not all contiguous, then skip the remainder of these substeps.

    5. Split first-fn on spaces, and let part one be the first resulting token, and part two be the second, if any, or the empty string if there is no second token. (There cannot be three, given the previous step.)

    6. If the last character of part one is a U+002C COMMA character (,), then remove that character from part one and add a vCard line with the type "N" whose value is the concatenation of the following strings:

      1. The result of escaping the vCard text string part one
      2. A U+003B SEMICOLON character (;)
      3. The result of escaping the vCard text string part two
      4. Three U+003B SEMICOLON characters (;)

      Then, skip the remainder of these substeps.

    7. If part two is two Unicode code-points long and its second character is a U+002E FULL STOP character (.), then add a vCard line with the type "N" whose value is the concatenation of the following strings:

      1. The result of escaping the vCard text string part one
      2. A U+003B SEMICOLON character (;)
      3. The result of escaping the vCard text string consisting of the first character of part two
      4. Three U+003B SEMICOLON characters (;)

      Then, skip the remainder of these substeps.

    8. If part two is one Unicode code-point long, then add a vCard line with the type "N" whose value is the concatenation of the following strings:

      1. The result of escaping the vCard text string part one
      2. A U+003B SEMICOLON character (;)
      3. The result of escaping the vCard text string part two
      4. Three U+003B SEMICOLON characters (;)

      Then, skip the remainder of these substeps.

    9. Add a vCard line with the type "N" whose value is the concatenation of the following strings:

      1. The result of escaping the vCard text string part two
      2. A U+003B SEMICOLON character (;)
      3. The result of escaping the vCard text string part one
      4. Three U+003B SEMICOLON characters (;)
  13. Add a vCard line with the type "END" and the value "VCARD" to output.

When the above algorithm says that the user agent is to add a vCard line consisting of a type type, optionally some parameters, and a value value to a string output, it must run the following steps:

  1. Let line be an empty string.

  2. Append type, converted to ASCII uppercase, to line.

  3. If there are any parameters, then for each parameter, in the order that they were added, run these substeps:

    1. Append a U+003B SEMICOLON character (;) to line.

    2. Append the parameter's name to line.

    3. Append a U+003D EQUALS SIGN character (=) to line.

    4. Append the parameter's value to line.

  4. Append a U+003A COLON character (:) to line.

  5. Append value to line.

  6. Let maximum length be 75.

  7. If and while line is longer than maximum length Unicode code points long, run the following substeps:

    1. Append the first maximum length Unicode code points of line to output.

    2. Remove the first maximum length Unicode code points from line.

    3. Append a U+000D CARRIAGE RETURN character (CR) to output.

    4. Append a U+000A LINE FEED character (LF) to output.

    5. Append a U+0020 SPACE character to output.

    6. Let maximum length be 74.

  8. Append (what remains of) line to output.

  9. Append a U+000D CARRIAGE RETURN character (CR) to output.

  10. Append a U+000A LINE FEED character (LF) to output.

When the steps above require the user agent to obtain the result of collecting vCard subproperties named subname in subitem, the user agent must run the following steps:

  1. Let value be the empty string.

  2. For each property named subname in the item subitem, run the following substeps:

    1. If the value of the property is itself an item, then skip this property.

    2. If this is not the first property named subname in subitem (ignoring any that were skipped by the previous step), then append a U+002C COMMA character (,) to value.

    3. Append the result of escaping the vCard text string given by the value of the property to value.

  3. Return value.

When the steps above require the user agent to obtain the result of collecting the first vCard subproperty named subname in subitem, the user agent must run the following steps:

  1. If there are no properties named subname in subitem, then abort these substeps, returning the empty string.

  2. If the value of the first property named subname in subitem is an item, then abort these substeps, returning the empty string.

  3. Return the result of escaping the vCard text string given by the value of the first property named subname in subitem.

When the above algorithms say the user agent is to escape the vCard text string value, the user agent must use the following steps:

  1. Prefix every U+005C REVERSE SOLIDUS character (\) in value with another U+005C REVERSE SOLIDUS character (\).

  2. Prefix every U+002C COMMA character (,) in value with a U+005C REVERSE SOLIDUS character (\).

  3. Prefix every U+003B SEMICOLON character (;) in value with a U+005C REVERSE SOLIDUS character (\).

  4. Replace every U+000D CARRIAGE RETURN U+000A LINE FEED character pair (CRLF) in value with a U+005C REVERSE SOLIDUS character (\) followed by a U+006E LATIN SMALL LETTER N character (n).

  5. Replace every remaining U+000D CARRIAGE RETURN (CR) or U+000A LINE FEED (LF) character in value with a U+005C REVERSE SOLIDUS character (\) followed by a U+006E LATIN SMALL LETTER N character (n).

  6. Return the mutated value.

This algorithm can generate invalid vCard output, if the input does not conform to the rules described for the http://microformats.org/profile/hcard item type and defined property names.

3 Examples

Here is a long example vCard for a fictional character called "Jack Bauer":

<section id="jack" itemscope itemtype="http://microformats.org/profile/hcard">
 <h1 itemprop="fn">Jack Bauer</h1>
 <img itemprop="photo" alt="" src="jack-bauer.jpg">
 <p itemprop="org" itemscope>
  <span itemprop="organization-name">Counter-Terrorist Unit</span>
  (<span itemprop="organization-unit">Los Angeles Division</span>)
 </p>
 <p>
  <span itemprop="adr" itemscope>
   <span itemprop="street-address">10201 W. Pico Blvd.</span><br>
   <span itemprop="locality">Los Angeles</span>,
   <span itemprop="region">CA</span>
   <span itemprop="postal-code">90064</span><br>
   <span itemprop="country-name">United States</span><br>
  </span>
  <span itemprop="geo">34.052339;-118.410623</span>
 </p>
 <h2>Assorted Contact Methods</h2>
 <ul>
  <li itemprop="tel" itemscope><span itemprop="value">+1 (310)
  597 3781</span> <span itemprop="type">work</span> <meta
  itemprop="type" content="pref"></li>
  <li><a itemprop="url"
  href="http://en.wikipedia.org/wiki/Jack_Bauer">I'm on
  Wikipedia</a> so you can leave a message on my user talk
  page.</li>
  <li><a itemprop="url"
  href="http://www.jackbauerfacts.com/">Jack Bauer Facts</a></li>
  <li itemprop="email"><a
  href="mailto:j.bauer@la.ctu.gov.invalid">j.bauer@la.ctu.gov.invalid</a></li>
  <li itemprop="tel" itemscope><span itemprop="value">+1 (310) 555
  3781</span> <span><meta itemprop="type" content="cell">mobile
  phone</span></li>
 </ul>
 <p itemprop="note">If I'm out in the field, you may be better off
 contacting <span itemprop="agent" itemscope
 itemtype="http://microformats.org/profile/hcard"><a
 itemprop="email" href="mailto:c.obrian@la.ctu.gov.invalid"><span
 itemprop="fn">Chloe O'Brian</span></a></span> if it's about
 work, or ask <span itemprop="agent">Tony Almeida</span> if
 you're interested in the CTU five-a-side football team we're trying
 to get going.</p>
 <ins datetime="2008-07-20T21:00:00+0100">
  <span itemprop="rev" itemscope>
   <meta itemprop="type" content="date-time">
   <meta itemprop="value" content="2008-07-20T21:00:00+0100">
  </span>
  <p itemprop="tel" itemscope><strong>Update!</strong>
  My new <span itemprop="type">home</span> phone number is
  <span itemprop="value">01632 960 123</span>.
 </ins>
</section>

This example shows a site's contact details (using the address element) containing an address with two street components:

<address itemscope itemtype="http://microformats.org/profile/hcard">
 <strong title="fn">Alfred Person</strong> <br>
 <span itemprop="adr" itemscope>
  <span itemprop="street-address">1600 Amphitheatre Parkway</span> <br>
  <span itemprop="street-address">Building 43, Second Floor</span> <br>
  <span itemprop="locality">Mountain View</span>,
   <span itemprop="region">CA</span> <span itemprop="postal-code">94043</span>
 </span>
</address>

The vCard vocabulary can be used to just mark up people's names:

<span itemscope itemtype="http://microformats.org/profile/hcard"
><span itemprop=fn>George Washington</span></span>

This creates a single item with a single name-value pair, with the name "fn" and the value "George Washington". This is defined to map to the following vCard:

BEGIN:VCARD
PROFILE:VCARD
VERSION:3.0
SOURCE:document's address
FN:George Washington
N:Washington;George;;;
END:VCARD

References

[E163]
Recommendation E.163 — Numbering Plan for The International Telephone Service, CCITT Blue Book, Fascicle II.2, pp. 128-134, November 1988.
[HTML5]
HTML5, I. Hickson. WHATWG, August 2009.
[RFC2426]
vCard MIME Directory Profile, F. Dawson, T. Howes. IETF, September 1998.
[RFC4770]
vCard Extensions for Instant Messaging (IM), C. Jennings, J. Reschke. IETF, January 2007.
[X121]
Recommendation X.121 — International Numbering Plan for Public Data Networks, CCITT Blue Book, Fascicle VIII.3, pp. 317-332, November 1988.