Introduction
xCard is vCard 4.0 written as XML. It is defined by RFC 6351 (August 2011), which says
the underlying data structure is exactly the same as in RFC 6350, so a card converts to XML and back without loss. The
media type is application/vcard+xml. RFC 6351 gives no file extension of its own (section 8.2 says XML data
should use .xml), and everything is in the namespace urn:ietf:params:xml:ns:vcard-4.0.
xCard is a separate format from vCard, not a variant of it: the same data, but another syntax, media type and value
writing. It has only the 4.0 data model: there is no version element, because the version is in the
namespace. The explorer opens a .xml file, or one with no extension, whose root element is
vcards in that namespace, in the xCard viewer.
Structure
The root element vcards holds one or more vcard elements, and must be present even for a single
card. A vcard holds property elements, and group elements (with a name attribute)
that hold property elements, for vCard's group prefix. A property is an element with the property's name in lower
case: an optional parameters element, then the value. A plain value is one element named for its type
(text, uri, date, language-tag...); a structured value (n,
adr, gender, clientpidmap) has one element for each component, named for what it
is (surname, street...).
0<vcards xmlns="urn:ietf:params:xml:ns:vcard-4.0"> the root1…<vcard> one contact1 or more…<fn>, <n>, <tel> and the other properties1 or more…<group name="…"> properties that share a groupoptional
FN:Simon Perreault
N:Perreault;Simon;;;ing. jr,M.Sc.
TEL;VALUE=uri;TYPE="work,voice":tel:+1-418-656-9254;ext=102
<fn><text>Simon Perreault</text></fn>
<n><surname>Perreault</surname><given>Simon</given><additional/><prefix/>
<suffix>ing. jr</suffix><suffix>M.Sc.</suffix></n>
<tel><parameters><type><text>work</text><text>voice</text></type></parameters>
<uri>tel:+1-418-656-9254;ext=102</uri></tel>
Converting
- vCard to xCard (RFC 6351 section 6): names become lower case, value escaping and parameter quoting are undone,
a property with no
VALUEand an unknown default type is written withunknown, and the content of anXMLproperty is copied as is. - xCard to vCard: names become upper case, escaping and quoting are applied again, a property in another
namespace is wrapped in an
XMLproperty, and anunknownvalue is taken over without aVALUEparameter. The viewer addsBEGIN:VCARD,VERSION:4.0andEND:VCARD.
The viewer does this conversion and reads the resulting text with the vCard viewer, so the Contacts and Properties tabs work; its Mapping tab sets each element against the content line it becomes.
Not described
The pages follow RFC 6351, read in full from rfc-editor.org (the text, the example, and the relax-NG schema of appendix A). The element mapping page has every element of the schema.
Known, not yet covered
- Viewer: the XML is read with the explorer's XML reader (its tree, its Text tab and its well-formedness
problems), then each element is checked against the schema's elements and the value patterns, and the whole is converted to
vCard 4.0 text and read by the vCard viewer, whose problems are shown at the element that made each line. Not done: the
schema's cardinalities (every property has at most the number RFC 6350 allows) are checked only on the converted text; an
element in another namespace is reported and left out, not converted to an
XMLproperty; thetypevalues the schema lists for each property are not compared with the element (the vCard viewer checks the TYPE values of the text); a file over 24 MiB is shown as XML only. - Reference: properties registered after RFC 6350 (RFC 6474, 6715, 8605, 9554) have no element in the schema; they follow the generic rule of RFC 6351 section 5.1 and are described only by that rule.
Unknown
- Reference: RFC errata for RFC 6351 were not read.
Also used for
- Extensible Markup Language – Nested elements with tags and attributes, written as text.
- xCal: iCalendar in XML – iCalendar as XML: events, to-dos and time zones as elements.
Links
Developers
- ez-vcard – vCard library with xCard and jCard support (Java)
- sabre/vobject – reads and writes iCalendar and vCard, including their XML and JSON forms (PHP)