From RFC 6351 (xCard), read in full from rfc-editor.org, including the relax-NG schema of its appendix A. Every name is in the
namespace urn:ietf:params:xml:ns:vcard-4.0. The vCard side is on the
properties and versions and
syntax pages.
Properties
A property is an element with the property's name in lower case. The parameters column lists the parameters the schema allows
(parameters is optional on all of them). The default value type is the one of RFC 6350 section 6.
| Property | Content | Parameters |
|---|---|---|
source, member | uri | altid, pid, pref, mediatype |
photo, impp, url, fburl, caladruri, caluri | uri | altid, pid, pref, type, mediatype |
logo, sound | uri | language, altid, pid, pref, type, mediatype |
kind | zero or more text: individual, group, org, location, an x- name or an IANA token | none |
fn, title, role, note, email | text | language (not email), altid, pid, pref, type |
n | surname, given, additional, prefix, suffix: each one or more, empty when there is no value | language, sort-as, altid |
nickname, categories | one or more text | language (nickname), altid, pid, pref, type |
org | one or more text (the components of the structured value) | language, altid, pid, pref, type, sort-as |
bday, anniversary | date, date-time or time, or text | altid, calscale |
gender | sex (empty, M, F, O, N or U), then optionally identity | none |
adr | pobox, ext, street, locality, region, code, country: each one or more | language, altid, pid, pref, type, geo, tz, label |
tel | text or uri | altid, pid, pref, type (work, home, text, voice, fax, cell, video, pager, textphone), mediatype |
lang | language-tag | altid, pid, pref, type |
tz | text, uri or utc-offset | altid, pid, pref, type, mediatype |
geo | uri | altid, pid, pref, type, mediatype |
related | uri or text | altid, pid, pref, mediatype, type (work, home, contact, acquaintance, friend, met, co-worker, colleague, co-resident, neighbor, child, parent, sibling, spouse, kin, muse, crush, date, sweetheart, me, agent, emergency) |
prodid | text | none |
rev | timestamp | none |
uid | uri | none |
clientpidmap | sourceid (a positive integer) and uri | none |
key | uri or text | altid, pid, pref, type, mediatype |
There is no version element, no begin or end, and no element for xml: the
XML property is how other-namespace content is kept (below). The schema does not check how many times a property
may occur; the cardinalities of RFC 6350 still apply (section 5.2).
Parameters
| Parameter | Element | Content |
|---|---|---|
LANGUAGE | language | language-tag |
PREF | pref | integer, 1 to 100 |
ALTID, MEDIATYPE, LABEL | altid, mediatype, label | text |
PID | pid | one or more text, each digits with an optional .digits |
TYPE | type | one or more text: work, home in general, more for tel and related |
CALSCALE | calscale | text: gregorian |
SORT-AS | sort-as | one or more text |
GEO | geo | uri |
TZ | tz | text or uri |
an unrecognised or X- parameter | its lower-case name | unknown, the value text treated as text (section 6) |
A parameter that takes a list is written with one value element for each value, not a comma-separated text. VALUE has no
element, and there is no GROUP parameter: RFC 7095 reserves it for jCard.
Value elements
The dates and times keep the basic form of RFC 6350 section 4.3 (20090808T1430-0500), unlike jCard and xCal. The
patterns below are the schema's.
| Element | Content | Example |
|---|---|---|
text | the text, escaping undone | Simon Perreault |
uri | a URI | tel:+1-418-656-9254;ext=102 |
date | YYYYMMDD, YYYY-MM, --MM, --MMDD or ---DD | --0203 |
time | HH, HHMM or HHMMSS, or truncated (-MM, -MMSS, --SS), with an optional Z or +HH or +HHMM offset | 143000-0500 |
date-time | a date (YYYYMMDD, --MMDD or ---DD), T, then a time as above | 20090808T1430-0500 |
timestamp | YYYYMMDDTHHMMSS with an optional zone | 20090808T143000Z |
boolean, integer, float | xsd:boolean, xsd:integer, xsd:float | 1 |
utc-offset | +HH or +HHMM, or - | -0500 |
language-tag | a language tag (RFC 5646), as the schema's pattern has it | fr |
unknown | the unprocessed value text | alien.jpg |
There is no date-and-or-time element: a value that may be a date, a date-time or a time uses the element of
the form it has.
Groups and extensions
- Groups. vCard's
group.NAMEprefix is agroupelement with anameattribute that holds the properties:<group name="contact"><fn>…</fn><email>…</email></group>. - Unregistered extensions (
X-andVND-…-names) are elements whose names startx-orvnd-, in the vCard namespace, and new names MUST be lower case. Extensions with no vCard form SHOULD use their own XML namespace, and a reader MUST ignore elements and attributes whose expanded name it does not know (section 5.1). - Other-namespace properties become an
XMLproperty when converted to vCard: for example<a xmlns="http://www.w3.org/1999/xhtml" href="…">…</a>inside thevcardbecomesXML:<a xmlns="http://www.w3.org/1999/xhtml"\n href="…">…</a>.
Conversion rules (RFC 6351 section 6)
vCard to xCard
- A property with no
VALUEand an unknown default type is written withunknown; so is an unrecognised parameter value. - The content of an
XMLproperty is copied as is. Names become lower case. Value escaping is undone (\nbecomes a line feed). Double quoting and backslash escaping of a parameter value are undone.
xCard to vCard
- A property in the vCard namespace with a known text form uses it (
adrbecomes the semicolon-separated fields with comma lists); otherwise the name comes from the element, the parameters fromparametersand the content from the value element, and attributes and unknown child elements are dropped. - A property in another namespace is wrapped in an
XMLproperty. Anunknownvalue is taken over as is, and the property MUST NOT haveVALUE. Anunknownparameter value is treated astext. - Names become upper case; escaping and quoting are applied.
What the viewer reports
- a root that is not
vcardsin the namespace, a child of it that is notvcard, avcardwith no property, agroupwithout aname, aversionelement (xCard has none); - a structured property missing one of its component elements, or with an element it does not define; a
genderwhose sex is not M, F, O, N, U or empty; - a property with no value element, with value elements of different types, with an element that is not a value type, or with a type the property does not take; a value whose text does not match its type's pattern;
- a parameter holding text where a value element belongs, one whose value element is not the schema's, or a
valueparameter; - every problem the vCard viewer finds in the converted vCard 4.0 text, at the element that made the line.