Network Working Group                                       S. Perreault
Internet-Draft                                                  Viagenie
Obsoletes: 2425, 2426, 4770                             October 14, 2009
(if approved)
Updates: 2739 (if approved)
Intended status: Standards Track                        October 21, 2009
Expires: April 17, 24, 2010

                            vCard XML Schema
                    draft-ietf-vcarddav-vcardxml-00
                    draft-ietf-vcarddav-vcardxml-01

Status of This Memo

   This Internet-Draft is submitted to IETF in full conformance with the
   provisions of BCP 78 and BCP 79.

   Internet-Drafts are working documents of the Internet Engineering
   Task Force (IETF), its areas, and its working groups.  Note that
   other groups may also distribute working documents as Internet-
   Drafts.

   Internet-Drafts are draft documents valid for a maximum of six months
   and may be updated, replaced, or obsoleted by other documents at any
   time.  It is inappropriate to use Internet-Drafts as reference
   material or to cite them other than as "work in progress."

   The list of current Internet-Drafts can be accessed at
   http://www.ietf.org/ietf/1id-abstracts.txt.

   The list of Internet-Draft Shadow Directories can be accessed at
   http://www.ietf.org/shadow.html.

   This Internet-Draft will expire on April 17, 24, 2010.

Copyright Notice

   Copyright (c) 2009 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 in effect on the date of
   publication of this document (http://trustee.ietf.org/license-info).
   Please review these documents carefully, as they describe your rights
   and restrictions with respect to this document.

Abstract

   This document defines the XML schema of the vCard data format.

Table of Contents

   1.  Introduction . . . . . . . . . . . . . . . . . . . . . . . . .  3
   2.  The Schema . . . . . . . . . . . . . . . . . . . . . . . . . .  3
   3.  Example: Author's XML vCard  . . . . . . . . . . . . . . . . .  3
   4.  Design Considerations  . . . . . . . . . . . . . . . . . . . .  4  5
     4.1.  Extensibility  . . . . . . . . . . . . . . . . . . . . . .  5
     4.2.  Limitations  . . . . . . . . . . . . . . . . . . . . . . .  5  6
   5.  Security Considerations  The "XML" vCard Property . . . . . . . . . . . . . . . . . . .  6
   6.  Security Considerations  . . . . . . . . . . . . . . . . . . .  7
   7.  IANA Considerations  . . . . . . . . . . . . . . . . . . . . .  7
     7.1.  Registration of the "XML" vCard Property . . . . . . . . .  8
     7.2.  Registration of the XML Namespace  . . . . . . . . . . . .  8
   8.  Acknowledgements . . . . . . . . . . . . . . . . . . . . . . .  8
   9.  References . . . . . . . . . . . . . . . . . . . . . . . . . .  8
     9.1.  Normative References . . . . . . . . . . . . . . . . . . .  8
     9.2.  Informative References . . .  6 . . . . . . . . . . . . . . .  8
   Appendix A.  Relax NG Schema . . . . . . . . . . . . . . . . . . .  6  8
   Appendix B.  Change Log (to be removed by RFC Editor prior to
                publication)  . . . . . . . . . . . . . . . . . . . . 10 14
     B.1.  Changes in -01 . . . . . . . . . . . . . . . . . . . . . . 14
     B.2.  Changes in -00 . . . . . . . . . . . . . . . . . . . . . . 10 15

1.  Introduction

   vCard [I-D.ietf-vcarddav-vcardrev] is a data format for representing
   and exchanging information about individuals.  It is a text-based
   format (as opposed to a binary format).  This document defines an XML
   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 stand-alone vCard parser.

   Earlier work on an XML format for vCard was started in 1998 by Frank
   Dawson [I-D.dawson-vcard-xml-dtd].  Sadly it did not take over the
   world.

2.  The Schema

   The schema is expressed in the RELAX NG language
   [relaxng][relaxng-compact] and is found in Appendix A.

3.  Example: Author's XML vCard

   <?xml version="1.0" encoding="UTF-8"?>
   <vcard
   <vcards xmlns="urn:ietf:params:xml:ns:vcard-4.0">
     <vcard>
       <fn><text>Simon Perreault</text></fn>
       <n>
         <surname><text>Perreault</text></surname>
         <given><text>Simon</text></given>
         <prefix><text/></prefix>
         <suffix>
           <text>ing. jr.</text>
           <text>M.Sc.</text>
         </suffix>
       </n>
       <bday><date>--0203</date></bday>
       <anniversary>
         <date-time>20090808T1430-0500</date-time>
       </anniversary>
       <sex>1</sex>
     <lang><pref>1</pref><language-tag>fr</language-tag></lang>
     <lang><pref>2</pref><language-tag>en</language-tag></lang>
     <group name="work">
       <org><text>Viagenie</text></org>
       <lang>
         <parameters><pref>1</pref></parameters>
         <language-tag>fr</language-tag>
       </lang>
       <lang>
         <parameters><pref>2</pref></parameters>
         <language-tag>en</language-tag>
       </lang>
       <org>
         <parameters><type><work/></type></parameters>
         <text>Viagenie</text>
       </org>
       <adr>
         <parameters><type><work/></type></parameters>
         <pobox><text/></pobox>
         <ext><text>Suite 625</text></ext>
         <street><text>2600 boul. Laurier</text></street>
         <locality><text>Quebec</text></locality>
         <region><text>QC</text></region>
         <code><text>G1V 4W1</text></code>
         <country><text>Canada</text></country>
       </adr>
       <tel>
         <type><voice/></type>
         <parameters><type><work/><voice/></type></parameters>
         <uri>tel:+1-418-656-9254;ext=102</uri>
       </tel>
       <tel>
         <type><text/><voice/><cell/><video/></type>
         <parameters>
           <type><work/><text/><voice/><cell/><video/></type>
         </parameters>
         <uri>tel:+1-418-262-6501</uri>
       </tel>
       <tel>
         <type><fax/></type>
         <parameters><type><work/><fax/></type></parameters>
         <uri>tel:+1-418-656-9257</uri>
       </tel>
       <email><text>simon.perreault@viagenie.ca</text></email>
       <geo><uri>geo:46.772673,-71.282945</uri></geo>
       <email>
         <parameters><type><work/></type></parameters>
         <text>simon.perreault@viagenie.ca</text>
       </email>
       <geo>
         <parameters><type><work/></type></parameters>
         <uri>geo:46.772673,-71.282945</uri>
       </geo>
       <key>
         <parameters><type><work/></type></parameters>
         <uri>http://www.viagenie.ca/simon.perreault/simon.asc</uri>
       </key>
     </group>
       <tz><text>America/Montreal</text></tz>
     <class><PUBLIC/></class>
       <class>PUBLIC</class>
     </vcard>
   </vcards>

4.  Design Considerations

   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.  That element in turn contains a text element whose
   content corresponds to the vCard property's value.

   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:

     <tel>
       <type><voice/></type>
       <parameters><type><voice/></type></parameters>
       <uri>tel:+1-555-555-555</uri>
     </tel>

   Properties having structured values (e.g. the N "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.

4.1.  Extensibility

   The original vCard format is extensible.  New properties, parameters,
   data types and values (collectively known as vCard objects) can be
   registered from IANA.  It is expected that these vCard extensions
   will also specify extensions to the XML format described in this
   document.  This is not a requirement: a separate document may be used
   instead.

   Unregistered extensions (i.e. those starting with "X-" and
   "VND-...-") can be expressed in XML by making use of XML namespaces.
   They simply correspond to elements outside of the core namespace.
   For example:

     <ext:my-prop
         ext:xmlns="http://example.com/extensions/my-vcard">
       <parameters>
         <pref>1</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 elements that are XML data qualified by a namespace it
   does not part of this
   specification. understand.

   In the original vCard format, the VERSION "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.

   Since vCard also has provisions for extending value enumerations,
   such as the allowed TYPE parameter values, these

   Parameters containing a list of values are expressed using tags a list of
   elements in XML. XML (e.g. the <type> element).

4.2.  Limitations

   The schema does not validate the cardinality of properties.  This is
   a limitation of the schema definition language.  Cardinalities of the
   origiginal
   original vCard format [I-D.ietf-vcarddav-vcardrev] 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.

5.  Security Considerations

   TBD

6.  Normative References

   [I-D.ietf-vcarddav-vcardrev]  Perreault, S. and P. Resnick, "vCard
                                 Format Specification",
                                 draft-ietf-vcarddav-vcardrev-08 (work  The "XML" vCard Property

   This document defines the following vCard property.

   Namespace:

   Property name:  XML

   Purpose:  To include XML-encoded vCard data in progress), July 2009.

   [relaxng]                     Clark, a plain vCard.

   Value type:  A single text value.

   Cardinality:  (0,n)

   Property parameters:  none allowed
   Description:  The content of this property is an XML chunk.  Its
      default XML namespace is "urn:ietf:params:xml:ns:vcard-4.0".  The
      elements allowed at the root level of this chunk are those that
      are allowed to be immediate children of the <vcard> element
      defined in this document.  The normal rules for extensibility
      apply (i.e. things in unknown namespaces are ignored).  The chunk
      is subject to normal line folding and escaping, i.e. replace all
      backslashes with "\\", then replace all newlines with "\n", then
      fold long lines.

   Format definition:

     XML-param = ""
     XML-value = text

   Example:  The three following vCards are equivalent.

     <?xml version="1.0"?>
     <vcards xmlns="urn:ietf:params:xml:ns:vcard-4.0">
       <vcard>
         <fn><text>John Doe</text></fn>
         <email><text>jdoe@example.com</text></email>
       </vcard>
     </vcards>

     BEGIN:VCARD
     VERSION:4.0
     XML:<fn><text>John Doe>/text></fn>\n
      <email><text>jdoe@example.com</text></email>
     END:VCARD

     BEGIN:VCARD
     VERSION:4.0
     FN:John Doe
     EMAIL:jdoe@example.com
     END:VCARD

6.  Security Considerations

   All the security considerations applicable to plain vCard
   [I-D.ietf-vcarddav-vcardrev] are applicable to this document as well.

7.  IANA Considerations
7.1.  Registration of the "XML" vCard Property

   The completed registration template can be found in section
   Section 5.

7.2.  Registration of the XML Namespace

   URI:  urn:ietf:params:xml:ns:vcard-4.0

   Registrant Contact:  Simon Perreault <simon.perreault@viagenie.ca>

   XML:  None.  Namespace URIs do not represent an XML specification.

8.  Acknowledgements

   Thanks to the following people for their input:

   Alexey Melnikov, Barry Leiba, Cyrus Daboo, Joe Hildebrand, Joseph
   Smarr, Marc Blanchet, Peter Saint-Andre, Robins George, Zahhar
   Kirillov, Zoltan Ordogh.

9.  References

9.1.  Normative References

   [I-D.ietf-vcarddav-vcardrev]  Perreault, S. and P. Resnick, "vCard
                                 Format Specification",
                                 draft-ietf-vcarddav-vcardrev-09 (work
                                 in progress), October 2009.

   [relaxng]                     Clark, J., "RELAX NG Specification",
                                 December 2001.

   [relaxng-compact]             Clark, J., "RELAX NG Compact Syntax",
                                 November 2002.

9.2.  Informative References

   [I-D.dawson-vcard-xml-dtd]    Dawson, F., "The vCard v3.0 XML DTD",
                                 draft-dawson-vcard-xml-dtd-03 (work in
                                 progress), June 1998.

Appendix A.  Relax NG Schema

 default namespace = "urn:ietf:params:xml:ns:vcard-4.0"

 # Value types
 \text = element text { text }
 text-list = \text+
 uri = element uri { xsd:anyURI }
 date = element date {
     xsd:string { pattern = "\d{8}|\d{4}-\d\d|--\d\d(\d\d)?|---\d\d" }
   }
 time = element time {
     xsd:string { pattern = "(\d\d(\d\d(\d\d)?)?|-\d\d(\d\d?)|--\d\d)"
                          ~ "(Z|[+\-]\d\d(\d\d)?)?" }
   }
 date-time = element date-time {
     xsd:string { pattern = "(\d{8}|--\d{4}|---\d\d)T\d\d(\d\d(\d\d)?)?"
                          ~ "(Z|[+\-]\d\d(\d\d)?)?" }
   }
 date-and-or-time = date | date-time | time
 timestamp = element timestamp {
     xsd:string { pattern = "\d{8}T\d{6}(Z|[+\-]\d\d(\d\d)?)?" }
   }
 boolean = element boolean { xsd:boolean }
 integer = element integer { xsd:integer }
 float = element float { xsd:float }
 binary = element binary { xsd:base64Binary }
 language-tag = element language-tag {
     xsd:string { pattern = "([a-z]{2,3}((-[a-z]{3}){0,3})?|[a-z]{4,8})"
                          ~ "(-[a-z]{4})?(-([a-z]{2}|\d{3}))?"
                          ~ "(-([0-9a-z]{5,8}|\d[0-9a-z]{3}))*"
                          ~ "(-[0-9a-wyz](-[0-9a-z]{2,8})+)*(-x(-[0-9a-z]{1,8})+)?|" "(-[0-9a-wyz](-[0-9a-z]{2,8})+)*"
                          ~ "x(-[0-9a-z]{1,8})+|[a-z]{1,3}(-[0-9a-z]{2,8}){1,2}" }
     }
   data =
     (element type {
        xsd:string { pattern = "[A-Za-z\d!#$&.+\-^_]{1,127}/" "(-x(-[0-9a-z]{1,8})+)?|x(-[0-9a-z]{1,8})+|"
                          ~ "[A-Za-z\d!#$&.+\-^_]{1,127}" "[a-z]{1,3}(-[0-9a-z]{2,8}){1,2}" }
   }
      },
      binary)
     | uri

 # Parameters
 language = element language { language-tag }?
 pref = element pref {
     xsd:integer { minInclusive = "1" maxInclusive = "100" }
   }?
 pid = element pid {
     xsd:string { pattern = "\d+(\.\d+)?" }
   }?
 type = element type {
     element work { empty }?,
     element home { empty }?
   }?

 # Properties
 source = element source {
     element parameters { pid, pref, pref },
     uri
   }

 name = element name { \text }
 kind = element kind {
     element individual { empty }
     | element group { empty }
     | element org { empty }
     | element location { empty }
   }
 fn = element fn {
     element parameters { language, pid, pref, type }?,
     \text
   }
 n = element n {
       language,
     element parameters { language }?,
     element surname { text-list },
     element given { text-list },
     element prefix { text-list },
     element suffix { text-list }
   }
 nickname = element nickname {
     element parameters { language, pid, pref, type }?,
     text-list
   }
 photo = element photo {
     element parameters {
       pid,
       pref, data
       element type {
         element work { empty }?,
         element home { empty }?,
         element media { \text }?
       }
     }?,
     (binary | uri)
   }
 bday = element bday { date-and-or-time | \text }
 dday = element dday { date-and-or-time | \text }
 birth = element birth { language,
     element parameters { language }?,
     \text
   }
 death = element death { language,
     element parameters { language }?,
     \text
   }
 anniversary = element anniversary { date-and-or-time | \text }
 sex = element sex { "0" | "1" | "2" | "9" }
 adr = element adr {
     element parameters {
       language,
       pid,
       pref,
       type,
       element geo { uri }?,
       element tz { \text | uri }?
     }?,
       pid,
       pref,
     element pobox { text-list },
     element ext { text-list },
     element street { text-list },
     element locality { text-list },
     element region { text-list },
     element code { text-list },
     element country { text-list }
   }
 label = element label {
     element parameters { language, pid, pref, type }?,
     \text
   }
 tel = element tel {
     element parameters {
       pid,
       pref,
       element type {
         element work { empty }?,
         element home { empty }?,
         element text { empty }?,
         element voice { empty }?,
         element fax { empty }?,
         element cell { empty }?,
         element video { empty }?,
         element pager { empty }?
       }?,
       pid,
       pref,
       }?
     },
     uri
   }
 email = element email {
     element parameters { pid, pref, type }?,
     \text
   }
 impp = element impp {
     element parameters { pid, pref, type }?,
     uri
   }
 lang = element lang {
     element parameters { pid, pref, type }?,
     language-tag
   }

 tz = element tz {
     element parameters { pid, pref, type }?,
     (\text | uri)
   }
 geo = element geo {
     element parameters { pid, pref, type }?,
     uri
   }
 title = element title {
     element parameters { language, pid, pref, type }?,
     \text
   }
 role = element role {
     element parameters { language, pid, pref, type }?,
     \text
   }
 logo = element logo {
     element parameters {
       language,
       pid,
       pref, data
       element type {
         element work { empty }?,
         element home { empty }?,
         element media { \text }?
       }
     }?,
     (binary | uri)
   }
 org = element org {
     element parameters { language, pid, pref, type }?,
     text-list
   }
 member = element member { pid, pref, uri }
 related = element related {
     element parameters {
       pid,
       pref,
       element type {
         element work { empty }?,
         element home { empty }?,
         (  element parent { empty }
          | element child { empty }
          | element sibling { empty }
          | element spouse { empty }
          | element family { empty }
          | element friend { empty }
          | element supervisor { empty }
          | element supervisee { empty }
          | element assistant { empty }
          | element colleague { empty }
          | element agent { empty }
          | element emergency { empty } })
       }?
     }?,
       pid,
       pref,
     (uri | \text)
   }
 categories = element categories {
     element parameters { pid, pref, type }?,
     \text
   }
 note = element note {
     element parameters { language, pid, pref, type }?,
     \text
   }
 prodid = element prodid { \text }
 rev = element rev { timestamp }
 sort-string = element sort-string { \text }
 sound = element sound {
     element parameters {
       language,
       pid,
       pref, data
       element type {
         element work { empty }?,
         element home { empty }?,
         element media { \text }?
       }
     }?,
     (binary | uri)
   }
 uid = element uid { uri }
 clientpidmap = element clientpidmap {
     element sourceid { xsd:positiveInteger },
     uri
   }
 url = element url {
     element parameters { pid, pref, type }?,
     uri
   }
 class = element class {
       element PUBLIC { empty } "PUBLIC" | element PRIVATE { empty } "PRIVATE" | element CONFIDENTIAL { empty } "CONFIDENTIAL" }
 key = element key {
     element parameters {
       pid,
       pref, data
       element type {
         element work { empty }?,
         element home { empty }?,
         element media { \text }?
       }
     }?,
     (binary | uri)
   }
 fburl = element fburl {
     element parameters { pid, pref, type }?,
     uri
   }
 caladruri = element caladruri {
     element parameters { pid, pref, type }?,
     uri
   }
 caluri = element caluri {
     element parameters { pid, pref, type }?,
     uri
   }

 # Top-level grammar
   group-property
 property = fn | nickname | photo | adr | label | tel anniversary | email bday |
     impp birth | lang caladruri | tz caluri
          | geo categories | title class | role clientpidmap | logo dday | org death | related email
          |
     categories fburl | note fn | sound geo | url impp | key | fburl kind | caladruri label | caluri
   any-property = group-property lang | source logo
          | member | n | name | kind nickname | n note | bday org |
     dday photo | birth prodid
          | death related | anniversary rev | role | sex | member sort-string | prodid sound |
     rev source
          | sort-string tel | uid title | clientpidmap tz | class uid | url
 start = element vcards {
     element vcard {
       (any-property
       (property
        | element group {
            attribute name { text },
            group-property*
          })*
            property*
          })+
     }+
   }

Appendix B.  Change Log (to be removed by RFC Editor prior to
             publication)

B.1.  Changes in -01

   o  Synchronized with draft-ietf-vcarddav-vcardrev-09.

   o  Added the <vcards> element to allow multiple vCards in a single
      XML file.

   o  Created the <parameters> container element.

   o  Use text value for enumeration in <class> element.

   o  Created the "XML" vCard property.

   o  Added IANA considerations section.

   o  Added security considerations section.

B.2.  Changes in -00

   o  Same as draft-perreault-vcarddav-vcardxml-02.

Author's Address

   Simon Perreault
   Viagenie
   2600 boul. Laurier, suite 625
   Quebec, QC  G1V 4W1
   Canada

   Phone: +1 418 656 9254
   EMail: simon.perreault@viagenie.ca
   URI:   http://www.viagenie.ca