Internet Engineering Task Force (IETF) S. Perreault Request for Comments: 6351 Viagenie Category: Standards Track August 2011 ISSN: 2070-1721
xCard: vCard XML Representation
Abstract
This document defines the XML schema of the vCard data format.
Status of This Memo
This is an Internet Standards Track document.
This document is a product of the Internet Engineering Task Force (IETF). It represents the consensus of the IETF community. It has received public review and has been approved for publication by the Internet Engineering Steering Group (IESG). Further information on Internet Standards is available in Section 2 of RFC 5741.
Information about the current status of this document, any errata, and how to provide feedback on it may be obtained at http://www.rfc-editor.org/info/rfc6351.
Copyright Notice
Copyright (c) 2011 IETF Trust and the persons identified as the document authors. All rights reserved.
This document is subject to BCP 78 and the IETF Trust's Legal Provisions Relating to IETF Documents (http://trustee.ietf.org/license-info) in effect on the date of publication of this document. Please review these documents carefully, as they describe your rights and restrictions with respect to this document. Code Components extracted from this document must include Simplified BSD License text as described in Section 4.e of the Trust Legal Provisions and are provided without warranty as described in the Simplified BSD License.
vCard [RFC6350] is a data format for representing and exchanging information about individuals and other entities. It is a text-based format (as opposed to a binary format). This document defines xCard, an XML [W3C.REC-xml-20081126] representation for vCard. The underlying data structure is exactly the same, enabling a 1-to-1 mapping between the original vCard format and the XML representation. The XML formatting may be preferred in some contexts where an XML engine is readily available and may be reused instead of writing a standalone vCard parser.
Earlier work on an XML format for vCard was started in 1998 by Frank Dawson [VCARD-DTD]. Sadly, it did not take over the world.
The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in [RFC2119].
The general idea is to map vCard parameters, properties, and value types to XML elements. For example, the "FN" property is mapped to the "fn" element. In turn, that element contains a text element whose content corresponds to the vCard property's value.
Perreault Standards Track [Page 4]
RFC 6351 xCard August 2011
vCard parameters are also mapped to XML elements. They are contained in the <parameters> element, which is contained in property elements. For example, the "TYPE" parameter applied to the "TEL" property would look like the following in XML:
Parameters taking a list of values are simply repeated multiple times, once for each value in the list.
Properties having structured values (e.g., the "N" property) are expressed by XML element trees. Element names in that tree (e.g., "surname", "given", etc.) do not have a vCard equivalent since they are identified by position in plain vCard.
Line folding is a non-issue in XML. Therefore, the mapping from vCard to XML is done after the unfolding procedure is carried out. Conversely, the mapping from XML to vCard is done before the folding procedure is carried out.
A top-level <vcards> element is used as root. It contains one or more <vcard> elements, each representing a complete vCard. The <vcards> element MUST be present even when only a single vCard is present in an XML document.
The group construct (Section 3.2 in [RFC6350]) is represented with the <group> element. The "name" attribute contains the group's name. For example:
The original vCard format is extensible. New properties, parameters, data types and values (collectively known as vCard elements, not to be confused with XML elements) can be registered with IANA (see [RFC6350], Section 10.2). It is expected that these vCard extensions will also specify extensions to the XML format described in this document.
New XML vCard property and parameter element names MUST be lower- case. This is necessary to ensure that round-tripping between XML and plain-text vCard works correctly.
Unregistered extensions (i.e., those starting with "X-" and "VND-...-") are expressed in XML by using elements starting with "x-" and "vnd-...-". Usage of XML namespaces [W3C.REC-xml-names-20091208] for extensibility is RECOMMENDED for extensions that have no equivalent in plain-text vCard. Refer to Section 6 for the implications when converting between plain-text vCard and XML.
<ext:my-prop ext:xmlns="http://example.com/extensions/my-vcard"> <parameters> <pref><integer>1</integer></pref> </parameters> <!-- Core vCard elements --> <text>value goes here</text> <!-- are still accessible --> </ext:my-prop>
Note that extension elements do not need the "X-" or "VND-" prefix in XML. The XML namespace mechanism is sufficient.
A vCard XML parser MUST ignore XML elements and attributes for which it doesn't recognize the expanded name. The normal behavior of ignoring XML processing instructions whose target is not recognized MUST also be followed.
In the original vCard format, the "VERSION" property was mandatory and played a role in extensibility. In XML, this property is absent. Its role is played by the vCard core namespace identifier, which includes the version number. vCard revisions will use a different namespace.
Parameters containing a list of values are expressed using a list of elements in XML (e.g., the <type> element).
The schema does not validate the cardinality of properties. This is a limitation of the schema definition language. Cardinalities of the original vCard format [RFC6350] MUST still be respected.
Some constructs (e.g., value enumerations in type parameters) have additional ordering constraints in XML. This is a result of limitations of the schema definition language, and the order is arbitrary. The order MUST be respected in XML for the vCard to be valid. However, reordering as part of conversion to or from plain vCard MAY happen.
When new properties or "X-" properties are used, a vCard<->xCard converter might not recognize them or know what the appropriate default value types are, yet they need to be able to preserve the values. A similar issue arises for unrecognized property parameters. As a result, the following rules are applied when dealing with unrecognized properties and property parameters:
o When converting from vCard to xCard:
* Any property that does not include a "VALUE" parameter and whose default value type is not known MUST be converted using the value type XML element <unknown>. The content of that element is the unprocessed value text.
* Any unrecognized property parameter MUST be converted using the value type XML element <unknown>, with its content set to the parameter value text, treated as if it were a text value, or list of text values.
* The content of "XML" properties is copied as is to XML.
* Property and parameter XML element names are converted to lower-case.
* Property value escaping is undone. For example, "\n" becomes a NEWLINE character (ASCII decimal 10).
* Double-quoting of parameter values, as well as backslash escaping in parameter values, is undone. For example, PARAM="\"foo\",\"bar\"" becomes <param>"foo","bar"</param>.
o When converting xCard to vCard:
* Properties in the vCard 4 namespace:
+ If the converter knows of a specific plain-text representation for this property, it uses it. For example, the <adr> element corresponds to the "ADR" property, which is encoded using comma-separated lists separated by semicolons.
+ Otherwise, the property name is taken from the element name, property parameters are taken from the <parameters> element, and the content of the property is taken from the content of the value element. If the property element has attributes or contains other XML elements, they are dropped.
Perreault Standards Track [Page 8]
RFC 6351 xCard August 2011
+ If a standard property's XML element contains XML elements and attributes for which the converter doesn't recognize the expanded name, they are dropped. Therefore, it is RECOMMENDED to limit extensions to the property level to ensure that all data is preserved intact in round-trip conversions.
* Properties in other namespaces are wrapped as is inside an "XML" property.
* Any <unknown> property value XML elements are converted directly into vCard values. The containing property MUST NOT have a "VALUE" parameter.
* Any <unknown> parameter value XML elements are converted as if they were <text> value type XML elements.
* Property and parameter names are converted to upper-case.
* Property value escaping (Section 3.3 of [RFC6350]) is carried out. For example, a NEWLINE character (ASCII decimal 10) becomes "\n".
* Double-quoting of parameter values, as well as backslash escaping in parameter values, is carried out. For example, <param>"foo","bar"</param> becomes PARAM="\"foo\",\"bar\"".
All the security considerations applicable to plain vCard [RFC6350] are applicable to this document as well.
XML Signature [W3C.CR-xmldsig-core1-20110303] and XML Encryption [W3C.CR-xmlenc-core1-20110303] can be used with xCard to provide authentication and confidentiality.
This section defines the MIME media type [RFC4288] for use with vCard-in-XML data.
To: ietf-types@iana.org
Subject: Registration of media type application/vcard+xml
Type name: application
Subtype name: vcard+xml
Required parameters: none
Optional parameters: charset as defined for application/xml in [RFC3023]; per [RFC3023], use of the charset parameter with the value "utf-8" is "STRONGLY RECOMMENDED".
Encoding considerations: Same as encoding considerations of application/xml as specified in [RFC3023].
Security considerations: This media type has all of the security considerations described in [RFC3023], plus those listed in Section 7.
Interoperability considerations: This media type provides an alternative syntax to vCard data [RFC6350] based on XML.
Published specification: This specification.
Applications that use this media type: Applications that currently make use of the text/vcard media type can use this as an alternative. In general, applications that maintain or process contact information can use this media type.
Perreault Standards Track [Page 11]
RFC 6351 xCard August 2011
Additional information:
Magic number(s): none
File extension(s): XML data should use ".xml" as the file extension.
Macintosh file type code(s): none
Person & email address to contact for further information: Simon Perreault <simon.perreault@viagenie.ca>
Alexey Melnikov, Barry Leiba, Bjorn Hoehrmann, Cyrus Daboo, Joe Hildebrand, Joseph Smarr, Marc Blanchet, Mike Douglass, Peter Saint- Andre, Robins George, Zahhar Kirillov, Zoltan Ordogh.
[ISO.19757-2.2008] International Organization for Standardization, "Information technology -- Document Schema Definition Language (DSDL) -- Part 2: Regular-grammar-based validation -- RELAX NG", ISO International Standard 19757-2, October 2008.
[RFC2119] Bradner, S., "Key words for use in RFCs to Indicate Requirement Levels", BCP 14, RFC 2119, March 1997.
[RFC3023] Murata, M., St. Laurent, S., and D. Kohn, "XML Media Types", RFC 3023, January 2001.
[RFC6350] Perreault, S., "vCard Format Specification", RFC 6350, August 2011.
Perreault Standards Track [Page 12]
RFC 6351 xCard August 2011
[W3C.REC-xml-20081126] Paoli, J., Yergeau, F., Maler, E., Bray, T., and C. Sperberg-McQueen, "Extensible Markup Language (XML) 1.0 (Fifth Edition)", World Wide Web Consortium Recommendation REC-xml-20081126, November 2008, <http://www.w3.org/TR/2008/REC-xml-20081126>.
[W3C.REC-xml-names-20091208] Bray, T., Hollander, D., Layman, A., Tobin, R., and H. Thompson, "Namespaces in XML 1.0 (Third Edition)", World Wide Web Consortium Recommendation REC-xml-names-20091208, December 2009, <http://www.w3.org/TR/2009/REC-xml-names-20091208>.
[RFC4288] Freed, N. and J. Klensin, "Media Type Specifications and Registration Procedures", BCP 13, RFC 4288, December 2005.
[VCARD-DTD] Dawson, F., "The vCard v3.0 XML DTD", Work in Progress, June 1998.
[W3C.CR-xmldsig-core1-20110303] Roessler, T., Solo, D., Yiu, K., Reagle, J., Hirsch, F., Eastlake, D., and M. Nystroem, "XML Signature Syntax and Processing Version 1.1", World Wide Web Consortium CR CR- xmldsig-core1-20110303, March 2011, <http://www.w3.org/TR/2011/CR-xmldsig-core1-20110303>.
[W3C.CR-xmlenc-core1-20110303] Eastlake, D., Reagle, J., Roessler, T., and F. Hirsch, "XML Encryption Syntax and Processing Version 1.1", World Wide Web Consortium CR CR-xmlenc-core1-20110303, March 2011, <http://www.w3.org/TR/2011/CR-xmlenc-core1-20110303>.
# 6.1.4 property-kind = element kind { element text { "individual" | "group" | "org" | "location" | x-name | iana-token }* }
# 6.2.1 property-fn = element fn { element parameters { param-language, param-altid, param-pid, param-pref, param-type }?, value-text }
# 6.2.2 property-n = element n { element parameters { param-language, param-sort-as, param-altid }?, element surname { text }+, element given { text }+, element additional { text }+, element prefix { text }+, element suffix { text }+ }
Perreault Standards Track [Page 16]
RFC 6351 xCard August 2011
# 6.2.3 property-nickname = element nickname { element parameters { param-language, param-altid, param-pid, param-pref, param-type }?, value-text-list }
# 6.2.4 property-photo = element photo { element parameters { param-altid, param-pid, param-pref, param-type, param-mediatype }?, value-uri }
# 6.2.5 property-bday = element bday { element parameters { param-altid, param-calscale }?, (value-date-and-or-time | value-text) }
# 6.2.6 property-anniversary = element anniversary { element parameters { param-altid, param-calscale }?, (value-date-and-or-time | value-text) }
# 6.2.7 property-gender = element gender { element sex { "" | "M" | "F" | "O" | "N" | "U" }, element identity { text }? }
# 6.3.1 param-label = element label { value-text }? property-adr = element adr { element parameters { param-language, param-altid, param-pid, param-pref, param-type, param-geo, param-tz, param-label }?, element pobox { text }+, element ext { text }+, element street { text }+, element locality { text }+, element region { text }+, element code { text }+, element country { text }+ }
Perreault Standards Track [Page 17]
RFC 6351 xCard August 2011
# 6.4.1 property-tel = element tel { element parameters { param-altid, param-pid, param-pref, element type { element text { "work" | "home" | "text" | "voice" | "fax" | "cell" | "video" | "pager" | "textphone" }+ }?, param-mediatype }?, (value-text | value-uri) }
# 6.4.2 property-email = element email { element parameters { param-altid, param-pid, param-pref, param-type }?, value-text }
# 6.4.3 property-impp = element impp { element parameters { param-altid, param-pid, param-pref, param-type, param-mediatype }?, value-uri }
# 6.4.4 property-lang = element lang { element parameters { param-altid, param-pid, param-pref, param-type }?, value-language-tag }