Internet DRAFT - draft-urpalainen-simple-presence-relaxng

draft-urpalainen-simple-presence-relaxng






SIMPLE WG                                                  J. Urpalainen
Internet-Draft                                                     Nokia
Intended status: Informational                           October 9, 2008
Expires: April 12, 2009


              Combined Presence Schemas Utilizing RELAX NG
              draft-urpalainen-simple-presence-relaxng-05

Status of this Memo

   By submitting this Internet-Draft, each author represents that any
   applicable patent or other IPR claims of which he or she is aware
   have been or will be disclosed, and any of which he or she becomes
   aware will be disclosed, in accordance with Section 6 of 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 12, 2009.

Abstract

   This memo describes a batch of Presence Information Data Format
   (PIDF) and its extension schemas written with the RELAX NG schema
   language.  Unlike with the current W3C XML Schema language it is
   possible to write reasonable forwards and backwards compatible
   presence combination schemas.  These RELAX NG schemas are stricter
   than the W3C Schemas and thus the instance documents that validate
   with these schemas follow the intended content model more closely.
   Especially, these schemas are targeted to actual implementations in
   order to decrease interoperability problems.






Urpalainen               Expires April 12, 2009                 [Page 1]

Internet-Draft          Presence RELAX NG schemas           October 2008


Table of Contents

   1.  Introduction . . . . . . . . . . . . . . . . . . . . . . . . .  3
   2.  Conventions  . . . . . . . . . . . . . . . . . . . . . . . . .  3
   3.  Overview of the Presence RELAX NG Schemas  . . . . . . . . . .  4
   4.  PIDF schema  . . . . . . . . . . . . . . . . . . . . . . . . .  5
   5.  DataModel schema . . . . . . . . . . . . . . . . . . . . . . .  8
   6.  RPID schema  . . . . . . . . . . . . . . . . . . . . . . . . . 11
   7.  CIPID schema . . . . . . . . . . . . . . . . . . . . . . . . . 27
   8.  CAPS schema  . . . . . . . . . . . . . . . . . . . . . . . . . 29
   9.  Location Types schema  . . . . . . . . . . . . . . . . . . . . 41
   10. Timed Status schema  . . . . . . . . . . . . . . . . . . . . . 44
   11. An example instance document . . . . . . . . . . . . . . . . . 45
   12. Security considerations  . . . . . . . . . . . . . . . . . . . 48
   13. Acknowledgments  . . . . . . . . . . . . . . . . . . . . . . . 48
   14. References . . . . . . . . . . . . . . . . . . . . . . . . . . 49
     14.1.  Normative references  . . . . . . . . . . . . . . . . . . 49
     14.2.  Informative references  . . . . . . . . . . . . . . . . . 50
   Author's Address . . . . . . . . . . . . . . . . . . . . . . . . . 50
   Intellectual Property and Copyright Statements . . . . . . . . . . 51































Urpalainen               Expires April 12, 2009                 [Page 2]

Internet-Draft          Presence RELAX NG schemas           October 2008


1.  Introduction

   Within a Common Presence Profile (CPP) [RFC3859] compatible presence
   system presence data is represented using the Extensible Markup
   Language (XML) [W3C.REC-xml-20060816] based Presence Information Data
   Format (PIDF) [RFC3863].  The PIDF format describes the baseline of
   the presence instance documents and currently many extensions have
   been described: e.g.  DataModel [RFC4479], RPID [RFC4480], CIPID
   [RFC4482], CAPS [RFC5196], LocationTypes [RFC4589] and TimedStatus
   [RFC4481].

   The content model of these XML documents is described primarily with
   the W3C XML Schema language [W3C.REC-xmlschema-1-20041028].  While
   the W3C XML Schema language has an extensive amount of impressive
   properties, for example the versioning support is still lacking.
   That is, it is impossible write reasonable forwards and backwards
   compatible schemas because of the "Unique Particle Attribution"
   constraint described in Appendix H of the recommendation
   [W3C.REC-xmlschema-1-20041028] and because wildcard definitions
   aren't flexible enough.  Therefore, all the presence extension
   schemas can not extend PIDF so that e.g. positions for the new
   elements could be defined within the extension schema so that
   wildcard definitions would still exist.  On the contrary, with the
   RELAX NG [relaxng] schema language it is possible to write a
   reasonable combination of schemas where the positioning of extensions
   while retaining wildcard definitions can easily be done.  In other
   words, these RELAX NG schemas are strict about extension positions,
   it is not possible to put extension elements into "wrong" locations.

   This memo describes a batch of these schemas which try to be as
   compatible as possible with the current presence W3C XML schemas.
   The set includes schemas for PIDF, DataModel, RPID, CIPID, CAPS and
   LocationTypes.  These schemas are more restrictive than the
   corresponding W3C XML Schemas, i.e. if instance documents validate
   according to these schemas they should also validate with the W3C XML
   Schemas, too.  These schemas are provided as informative to
   applications who wish to utilize RELAX NG as a validation tool.


2.  Conventions

   In this document, the key words "MUST", "MUST NOT", "REQUIRED",
   "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY",
   and "OPTIONAL" are to be interpreted as described in RFC 2119
   [RFC2119] and indicate requirement levels for compliant
   implementations.

   The following terms are used in this document:



Urpalainen               Expires April 12, 2009                 [Page 3]

Internet-Draft          Presence RELAX NG schemas           October 2008


   Forwards and backwards compatible schema:  Backwards compatibility
      means that existing instance documents can be used also by updated
      new consumers and forwards compatibility means that newer instance
      documents can also be used by existing consumers.

   Ambiguous schema:  A schema is said to be ambiguous when a document
      may be valid when its contents match multiple different pattern
      alternatives.

   Deterministic schema:  At each point, when matching an instance
      document against a schema, the schema processor has at most one
      possible choice.

   Wildcards in schemas:  In W3C XML Schemas <any> and <anyAttribute>
      definitions are wildcards.  They can be used to provide
      extensibility to the XML instance documents.  RELAX NG provides a
      very versatile though somewhat verbose model for wildcards with
      the <anyName> and <except> rules.


3.  Overview of the Presence RELAX NG Schemas

   All schemas written with the RELAX NG schema language are based on
   patterns.  The W3C Schema datatypes [W3C.REC-xmlschema-2-20041028]
   are used to constrain the element and attribute content in these
   schemas.

   The model for these schemas is based on the approximate chronological
   order of appearance of these schemas, i.e. the PIDF schema is the
   baseline schema and the DataModel schema includes it by adding some
   extensions.  Then the RPID schema includes the DataModel schema and
   defines new extensions, etc.  When an implementation wants to
   validate an instance document it just has to provide a single schema
   e.g. a RPID reference to the validator as that schema will include
   all the other schemas.

   Extension points, i.e. where <any> wildcards are used in W3C XML
   Schemas, are described by adding a similar extension definition which
   can be extended by using the combine="interleave" pattern rule.  The
   wildcard definition MUST be redefined in extension schemas since name
   classes MUST NOT overlap with the interleave pattern.  The schemas
   presented in this memo are thus deterministic and unambiguous
   although it is not a general requirement of the RELAX NG schema
   language.

   The ability to easily redefine extension points can help to detect
   implementation errors when an application does not have any
   extensions beyond e.g.  RPID and DataModel elements:



Urpalainen               Expires April 12, 2009                 [Page 4]

Internet-Draft          Presence RELAX NG schemas           October 2008


   <?xml version="1.0"?>
   <grammar xmlns="http://relaxng.org/ns/structure/1.0">

     <include href="rpid.rng">

       <!-- rule out extensions -->
       <define name="anyRPID">
         <empty/>
       </define>

       <define name="anyOtherAttr">
         <empty/>
       </define>

     </include>
   </grammar>


   Without touching the PIDF, DataModel or RPID schemas all the wildcard
   extensions have been practically removed.  Similarly, if "rpid.rng"
   is replaced with "prescaps.rng" and "anyRPID" with "anyCaps" the
   combined schema will rule out all the wildcard extensions while
   retaining the other element and attribute definitions within the
   PIDF, DataModel, RPID, CIPID and CAPS schemas.  Wildcards in these
   RELAX NG schemas do not strictly follow the "##other" namespace rules
   of the W3C Schema versions.  Instead a conservative and simple
   deterministic model were just chosen where wildcard except rules are
   redefined by just adding a new <nsName> namespace definitions onto
   the new <except> list.


4.  PIDF schema

   The RELAX NG version of the PIDF [RFC3863] schema.  Hereafter it is
   called with "pidf.rng" as if it were represented as an equivalent
   filesystem object.


   <?xml version="1.0"?>
   <grammar xmlns="http://relaxng.org/ns/structure/1.0"
       ns="urn:ietf:params:xml:ns:pidf"
       datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
     <start>
       <element name="presence">
         <attribute name="entity">
           <data type="anyURI"/>
         </attribute>
         <zeroOrMore>



Urpalainen               Expires April 12, 2009                 [Page 5]

Internet-Draft          Presence RELAX NG schemas           October 2008


           <element name="tuple">
             <attribute name="id">
               <data type="ID"/>
             </attribute>

             <element name="status">
               <optional>
                 <element name="basic">
                   <choice>
                     <value type="string">open</value>
                     <value type="string">closed</value>
                   </choice>
                 </element>
               </optional>

               <ref name="StatusExtension"/>
             </element>

             <ref name="TupleExtension"/>

             <optional>
               <element name="contact">
                 <optional>
                   <attribute name="priority">
                     <data type="decimal">
                       <param name="pattern"
                         >0(.[0-9]{0,3})?|1(.0{0,3})?</param>
                     </data>
                   </attribute>
                 </optional>
                 <data type="anyURI"/>
               </element>
             </optional>

             <zeroOrMore>
               <ref name="note"/>
             </zeroOrMore>

             <optional>
               <element name="timestamp">
                 <data type="dateTime"/>
               </element>
             </optional>
           </element>
         </zeroOrMore>

         <zeroOrMore>
           <ref name="note"/>



Urpalainen               Expires April 12, 2009                 [Page 6]

Internet-Draft          Presence RELAX NG schemas           October 2008


         </zeroOrMore>

         <ref name="PresenceExtension"/>
       </element>
     </start>

     <!-- extension point with interleave for presence -->
     <define name="PresenceExtension">
       <zeroOrMore>
         <ref name="anyPIDF"/>
       </zeroOrMore>
     </define>

     <!-- extension point with interleave for status -->
     <define name="StatusExtension">
       <zeroOrMore>
         <ref name="anyPIDF"/>
       </zeroOrMore>
     </define>

     <!-- extension point with interleave for tuple -->
     <define name="TupleExtension">
       <zeroOrMore>
         <ref name="anyPIDF"/>
       </zeroOrMore>
     </define>

     <!-- wildcard for other than pidf namespace -->
     <define name="anyPIDF">
       <element>
         <anyName>
           <except>
             <nsName ns="urn:ietf:params:xml:ns:pidf"/>
             <nsName ns=""/>
           </except>
         </anyName>
         <ref name="anyExtension"/>
       </element>
     </define>

     <!-- wildcard type for complex elements (of mixed type)
          without any namespace restrictions -->
     <define name="any">
       <element>
         <anyName/>
         <zeroOrMore>
           <choice>
             <attribute>



Urpalainen               Expires April 12, 2009                 [Page 7]

Internet-Draft          Presence RELAX NG schemas           October 2008


               <anyName/>
             </attribute>
             <text/>
             <ref name="any"/>
           </choice>
         </zeroOrMore>
      </element>
     </define>

     <!-- the rest of the "anyPIDF" wildcard definition -->
     <define name="anyExtension">
       <zeroOrMore>
         <choice>
           <attribute>
             <anyName/>
           </attribute>
           <ref name="any"/>
         </choice>
       </zeroOrMore>
     </define>

     <!-- note -->
     <define name="note">
       <element name="note">
         <optional>
           <attribute>
             <name ns="http://www.w3.org/XML/1998/namespace">lang</name>
             <data type="language"/>
           </attribute>
         </optional>
         <data type="string"/>
       </element>
     </define>
   </grammar>


   This is the only schema that defines a document root element.  The
   "anyPIDF" wildcard definition rules out elements from the PIDF
   namespace and also unqualified elements.  The "PresenceExtension",
   "StatusExtension" and "TupleExtension" definitions are extension
   points which can be extended by new element definitions with the
   combine="interleave" pattern.


5.  DataModel schema

   The RELAX NG version of the DataModel [RFC4479] schema, "data-
   model.rng":



Urpalainen               Expires April 12, 2009                 [Page 8]

Internet-Draft          Presence RELAX NG schemas           October 2008


   <?xml version="1.0"?>
   <grammar xmlns="http://relaxng.org/ns/structure/1.0"
     ns="urn:ietf:params:xml:ns:pidf:data-model"
     datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">

     <include href="pidf.rng">

       <!-- rule out data-model+pidf namespace -->
       <define name="anyPIDF">
         <ref name="anyDataModel"/>
       </define>

     </include>

     <!-- presence <device> extension definition -->
     <define name="PresenceExtension" combine="interleave">
       <interleave>
         <zeroOrMore>
           <element name="device">
             <attribute name="id">
               <data type="ID"/>
             </attribute>

             <ref name="DeviceExtension"/>

             <ref name="deviceIDDataModel"/>

             <zeroOrMore>
               <ref name="noteDataModel"/>
             </zeroOrMore>

             <optional>
               <ref name="timestampDataModel"/>
             </optional>
           </element>
         </zeroOrMore>

         <zeroOrMore>
           <element name="person">
             <attribute name="id">
               <data type="ID"/>
             </attribute>

             <ref name="PersonExtension"/>

             <zeroOrMore>
               <ref name="noteDataModel"/>
             </zeroOrMore>



Urpalainen               Expires April 12, 2009                 [Page 9]

Internet-Draft          Presence RELAX NG schemas           October 2008


             <optional>
               <ref name="timestampDataModel"/>
             </optional>
           </element>
         </zeroOrMore>
       </interleave>
     </define>

     <!-- tuple extension definition -->
     <define name="TupleExtension" combine="interleave">
       <optional>
         <ref name="deviceIDDataModel"/>
       </optional>
     </define>

     <!-- extension point with interleave for person element -->
     <define name="PersonExtension">
       <zeroOrMore>
         <ref name="anyDataModel"/>
       </zeroOrMore>
     </define>

     <!-- extension point with interleave for device element -->
     <define name="DeviceExtension">
       <zeroOrMore>
         <ref name="anyDataModel"/>
       </zeroOrMore>
     </define>

     <!-- wildcard from the other than
          pidf and data-model namespaces -->
     <define name="anyDataModel">
       <element>
         <anyName>
           <except>
             <nsName ns="urn:ietf:params:xml:ns:pidf:data-model"/>
             <nsName ns="urn:ietf:params:xml:ns:pidf"/>
             <nsName ns=""/>
           </except>
         </anyName>
         <ref name="anyExtension"/>
       </element>
     </define>

     <!-- data-model note -->
     <define name="noteDataModel">
       <element name="note">
         <optional>



Urpalainen               Expires April 12, 2009                [Page 10]

Internet-Draft          Presence RELAX NG schemas           October 2008


           <attribute>
             <name ns="http://www.w3.org/XML/1998/namespace">lang</name>
             <data type="language"/>
           </attribute>
         </optional>
         <data type="string"/>
       </element>
     </define>

     <!-- deviceID -->
     <define name="deviceIDDataModel">
       <element name="deviceID">
         <data type="anyURI"/>
       </element>
     </define>

     <!-- timestamp -->
     <define name="timestampDataModel">
       <element name="timestamp">
         <data type="dateTime"/>
       </element>
     </define>
   </grammar>


   The DataModel schema includes "pidf.rng" and the "anyPIDF" wildcard
   definition is redefined with "anyDataModel".  The "PersonExtension"
   and "DeviceExtension" definitions are DataModel extension points.


6.  RPID schema

   The RELAX NG version of the RPID [RFC4480] schema, "rpid.rng":


   <?xml version="1.0"?>
   <grammar xmlns="http://relaxng.org/ns/structure/1.0"
     ns="urn:ietf:params:xml:ns:pidf:rpid"
     datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">

     <include href="data-model.rng">

       <!-- rule out data-model+pidf+rpid namespace -->
       <define name="anyDataModel">
         <ref name="anyRPID"/>
       </define>

     </include>



Urpalainen               Expires April 12, 2009                [Page 11]

Internet-Draft          Presence RELAX NG schemas           October 2008


     <!-- person extension definition -->
     <define name="PersonExtension" combine="interleave">
       <ref name="PersonRPID"/>
     </define>

     <!-- device extension definition -->
     <define name="DeviceExtension" combine="interleave">
       <ref name="DeviceRPID"/>
     </define>

     <!-- tuple extension definition -->
     <define name="TupleExtension" combine="interleave">
       <ref name="TupleRPID"/>
     </define>

     <!-- wildcarcd from other than
          pidf, data-model and rpid namespace -->
     <define name="anyRPID">
       <element>
         <anyName>
           <except>
             <nsName ns="urn:ietf:params:xml:ns:pidf:rpid"/>
             <nsName ns="urn:ietf:params:xml:ns:pidf:data-model"/>
             <nsName ns="urn:ietf:params:xml:ns:pidf"/>
             <nsName ns=""/>
           </except>
         </anyName>
         <ref name="anyExtension"/>
       </element>
     </define>

     <!-- person extension -->
     <define name="PersonRPID">
       <interleave>
         <zeroOrMore>
           <ref name="activities"/>
         </zeroOrMore>
         <optional>
           <ref name="class"/>
         </optional>
         <zeroOrMore>
           <ref name="mood"/>
         </zeroOrMore>
         <zeroOrMore>
           <ref name="place-is"/>
         </zeroOrMore>
         <zeroOrMore>
           <ref name="place-type"/>



Urpalainen               Expires April 12, 2009                [Page 12]

Internet-Draft          Presence RELAX NG schemas           October 2008


         </zeroOrMore>
         <zeroOrMore>
           <ref name="privacy"/>
         </zeroOrMore>
         <zeroOrMore>
           <ref name="sphere"/>
         </zeroOrMore>
         <zeroOrMore>
           <ref name="status-icon"/>
         </zeroOrMore>
         <zeroOrMore>
           <ref name="time-offset"/>
         </zeroOrMore>
         <optional>
           <ref name="user-input"/>
         </optional>
       </interleave>
     </define>

     <!-- tuple extension -->
     <define name="TupleRPID">
       <interleave>
         <optional>
           <ref name="class"/>
         </optional>
         <zeroOrMore>
           <ref name="privacy"/>
         </zeroOrMore>
         <optional>
           <ref name="relationship"/>
         </optional>
         <optional>
           <ref name="service-class"/>
         </optional>
         <zeroOrMore>
           <ref name="status-icon"/>
         </zeroOrMore>
         <optional>
           <ref name="user-input"/>
         </optional>
       </interleave>
     </define>

     <!-- device extension -->
     <define name="DeviceRPID">
       <interleave>
         <optional>
           <ref name="class"/>



Urpalainen               Expires April 12, 2009                [Page 13]

Internet-Draft          Presence RELAX NG schemas           October 2008


         </optional>
         <optional>
           <ref name="user-input"/>
         </optional>
       </interleave>
     </define>

     <!-- activities -->
     <define name="activities">
       <element name="activities">
         <zeroOrMore>
           <element name="note">
             <ref name="noteRPID"/>
           </element>
         </zeroOrMore>
         <choice>
           <element name="unknown">
             <empty/>
           </element>
           <group>
             <interleave>
               <optional>
                 <element name="appointment"><empty/></element>
               </optional>
               <optional>
                 <element name="away"><empty/></element>
               </optional>
               <optional>
                 <element name="breakfast"><empty/></element>
               </optional>
               <optional>
                 <element name="busy"><empty/></element>
               </optional>
               <optional>
                 <element name="dinner"><empty/></element>
               </optional>
               <optional>
                 <element name="holiday"><empty/></element>
               </optional>
               <optional>
                 <element name="in-transit"><empty/></element>
               </optional>
               <optional>
                 <element name="looking-for-work"><empty/></element>
               </optional>
               <optional>
                 <element name="meal"><empty/></element>
               </optional>



Urpalainen               Expires April 12, 2009                [Page 14]

Internet-Draft          Presence RELAX NG schemas           October 2008


               <optional>
                 <element name="meeting"><empty/></element>
               </optional>
               <optional>
                 <element name="on-the-phone"><empty/></element>
               </optional>
               <optional>
                 <element name="performance"><empty/></element>
               </optional>
               <optional>
                 <element name="permanent-absence"><empty/></element>
               </optional>
               <optional>
                 <element name="playing"><empty/></element>
               </optional>
               <optional>
                 <element name="presentation"><empty/></element>
               </optional>
               <optional>
                 <element name="shopping"><empty/></element>
               </optional>
               <optional>
                 <element name="sleeping"><empty/></element>
               </optional>
               <optional>
                 <element name="spectator"><empty/></element>
               </optional>
               <optional>
                 <element name="steering"><empty/></element>
               </optional>
               <optional>
                 <element name="travel"><empty/></element>
               </optional>
               <optional>
                 <element name="tv"><empty/></element>
               </optional>
               <optional>
                 <element name="vacation"><empty/></element>
               </optional>
               <optional>
                 <element name="working"><empty/></element>
               </optional>
               <optional>
                 <element name="worship"><empty/></element>
               </optional>
               <zeroOrMore>
                 <element name="other">
                   <ref name="noteRPID"/>



Urpalainen               Expires April 12, 2009                [Page 15]

Internet-Draft          Presence RELAX NG schemas           October 2008


                 </element>
               </zeroOrMore>
             </interleave>
             <ref name="ActivitiesExtension"/>
            </group>
         </choice>
         <ref name="commonAttributes"/>
       </element>
     </define>

     <!-- defining common attributes in several elements -->
     <define name="commonAttributes">
       <ref name="fromUntil"/>

       <optional>
         <attribute name="id">
           <data type="ID"/>
         </attribute>
       </optional>

       <zeroOrMore>
         <ref name="anyOtherAttr"/>
       </zeroOrMore>
     </define>

     <!-- any attributes except already defined ones -->
     <define name="anyOtherAttr">
       <attribute>
         <anyName>
         <except>
           <name ns="">from</name>
           <name ns="">until</name>
           <name ns="">id</name>
         </except>
         </anyName>
       </attribute>
     </define>

     <!-- activities extension point -->
     <define name="ActivitiesExtension">
       <zeroOrMore>
         <ref name="anyRPID"/>
       </zeroOrMore>
     </define>

     <!-- class -->
     <define name="class">
       <element name="class">



Urpalainen               Expires April 12, 2009                [Page 16]

Internet-Draft          Presence RELAX NG schemas           October 2008


         <data type="token"/>
       </element>
     </define>

     <!-- mood -->
     <define name="mood">
       <element name="mood">
         <zeroOrMore>
           <element name="note">
             <ref name="noteRPID"/>
           </element>
         </zeroOrMore>
         <choice>
           <element name="unknown">
             <empty/>
           </element>
           <group>
             <interleave>
               <optional>
                 <element name="afraid"><empty/></element>
               </optional>
               <optional>
                 <element name="amazed"><empty/></element>
               </optional>
               <optional>
                 <element name="angry"><empty/></element>
               </optional>
               <optional>
                 <element name="annoyed"><empty/></element>
               </optional>
               <optional>
                 <element name="anxious"><empty/></element>
               </optional>
               <optional>
                 <element name="ashamed"><empty/></element>
               </optional>
               <optional>
                 <element name="bored"><empty/></element>
               </optional>
               <optional>
                 <element name="brave"><empty/></element>
               </optional>
               <optional>
                 <element name="calm"><empty/></element>
               </optional>
               <optional>
                 <element name="cold"><empty/></element>
               </optional>



Urpalainen               Expires April 12, 2009                [Page 17]

Internet-Draft          Presence RELAX NG schemas           October 2008


               <optional>
                 <element name="confused"><empty/></element>
               </optional>
               <optional>
                 <element name="contented"><empty/></element>
               </optional>
               <optional>
                 <element name="cranky"><empty/></element>
               </optional>
               <optional>
                 <element name="curious"><empty/></element>
               </optional>
               <optional>
                 <element name="depressed"><empty/></element>
               </optional>
               <optional>
                 <element name="disappointed"><empty/></element>
               </optional>
               <optional>
                 <element name="disgusted"><empty/></element>
               </optional>
               <optional>
                 <element name="distracted"><empty/></element>
               </optional>
               <optional>
                 <element name="embarrassed"><empty/></element>
               </optional>
               <optional>
                 <element name="excited"><empty/></element>
               </optional>
               <optional>
                 <element name="flirtatious"><empty/></element>
               </optional>
               <optional>
                 <element name="frustrated"><empty/></element>
               </optional>
               <optional>
                 <element name="grumpy"><empty/></element>
               </optional>
               <optional>
                 <element name="guilty"><empty/></element>
               </optional>
               <optional>
                 <element name="happy"><empty/></element>
               </optional>
               <optional>
                 <element name="hot"><empty/></element>
               </optional>



Urpalainen               Expires April 12, 2009                [Page 18]

Internet-Draft          Presence RELAX NG schemas           October 2008


               <optional>
                 <element name="humbled"><empty/></element>
               </optional>
               <optional>
                 <element name="humiliated"><empty/></element>
               </optional>
               <optional>
                 <element name="hungry"><empty/></element>
               </optional>
               <optional>
                 <element name="hurt"><empty/></element>
               </optional>
               <optional>
                 <element name="impressed"><empty/></element>
               </optional>
               <optional>
                 <element name="in_awe"><empty/></element>
               </optional>
               <optional>
                 <element name="in_love"><empty/></element>
               </optional>
               <optional>
                 <element name="indignant"><empty/></element>
               </optional>
               <optional>
                 <element name="interested"><empty/></element>
               </optional>
               <optional>
                 <element name="invincible"><empty/></element>
               </optional>
               <optional>
                 <element name="jealous"><empty/></element>
               </optional>
               <optional>
                 <element name="lonely"><empty/></element>
               </optional>
               <optional>
                 <element name="mean"><empty/></element>
               </optional>
               <optional>
                 <element name="moody"><empty/></element>
               </optional>
               <optional>
                 <element name="nervous"><empty/></element>
               </optional>
               <optional>
                 <element name="neutral"><empty/></element>
               </optional>



Urpalainen               Expires April 12, 2009                [Page 19]

Internet-Draft          Presence RELAX NG schemas           October 2008


               <optional>
                 <element name="offended"><empty/></element>
               </optional>
               <optional>
                 <element name="playful"><empty/></element>
               </optional>
               <optional>
                 <element name="proud"><empty/></element>
               </optional>
               <optional>
                 <element name="relieved"><empty/></element>
               </optional>
               <optional>
                 <element name="remorseful"><empty/></element>
               </optional>
               <optional>
                 <element name="restless"><empty/></element>
               </optional>
               <optional>
                 <element name="sad"><empty/></element>
               </optional>
               <optional>
                 <element name="sarcastic"><empty/></element>
               </optional>
               <optional>
                 <element name="serious"><empty/></element>
               </optional>
               <optional>
                 <element name="shocked"><empty/></element>
               </optional>
               <optional>
                 <element name="shy"><empty/></element>
               </optional>
               <optional>
                 <element name="sick"><empty/></element>
               </optional>
               <optional>
                 <element name="sleepy"><empty/></element>
               </optional>
               <optional>
                 <element name="stressed"><empty/></element>
               </optional>
               <optional>
                 <element name="surprised"><empty/></element>
               </optional>
               <optional>
                 <element name="thirsty"><empty/></element>
               </optional>



Urpalainen               Expires April 12, 2009                [Page 20]

Internet-Draft          Presence RELAX NG schemas           October 2008


               <optional>
                 <element name="worried"><empty/></element>
               </optional>
               <zeroOrMore>
                 <element name="other">
                   <ref name="noteRPID"/>
                 </element>
               </zeroOrMore>

             </interleave>
             <ref name="MoodExtension"/>
           </group>
         </choice>
         <ref name="commonAttributes"/>
       </element>
     </define>

     <!-- mood extension point -->
     <define name="MoodExtension">
       <zeroOrMore>
         <ref name="anyRPID"/>
       </zeroOrMore>
     </define>

     <!-- place-is -->
     <define name="place-is">
       <element name="place-is">
         <zeroOrMore>
           <element name="note">
             <ref name="noteRPID"/>
           </element>
         </zeroOrMore>
         <optional>
           <element name="audio">
             <choice>
               <element name="noisy"><empty/></element>
               <element name="ok"><empty/></element>
               <element name="quiet"><empty/></element>
               <element name="unknown"><empty/></element>
             </choice>
           </element>
         </optional>
         <optional>
           <element name="video">
             <choice>
               <element name="toobright"><empty/></element>
               <element name="ok"><empty/></element>
               <element name="dark"><empty/></element>



Urpalainen               Expires April 12, 2009                [Page 21]

Internet-Draft          Presence RELAX NG schemas           October 2008


               <element name="unknown"><empty/></element>
             </choice>
           </element>
         </optional>
         <optional>
           <element name="text">
             <choice>
               <element name="uncomfortable"><empty/></element>
               <element name="inappropriate"><empty/></element>
               <element name="ok"><empty/></element>
               <element name="unknown"><empty/></element>
             </choice>
           </element>
         </optional>
         <ref name="commonAttributes"/>
       </element>
     </define>

     <!-- place-type -->
     <define name="place-type">
       <element name="place-type">
         <zeroOrMore>
           <element name="note">
             <ref name="noteRPID"/>
           </element>
         </zeroOrMore>
         <choice>
           <element name="other">
             <ref name="noteRPID"/>
           </element>
           <ref name="PlaceTypeExtension"/>
         </choice>
         <ref name="commonAttributes"/>
       </element>
     </define>

     <!-- place-type extension point -->
     <define name="PlaceTypeExtension">
       <oneOrMore>
         <ref name="anyRPID"/>
       </oneOrMore>
     </define>

     <!-- privacy -->
     <define name="privacy">
       <element name="privacy">
         <zeroOrMore>
           <element name="note">



Urpalainen               Expires April 12, 2009                [Page 22]

Internet-Draft          Presence RELAX NG schemas           October 2008


             <ref name="noteRPID"/>
           </element>
         </zeroOrMore>
         <choice>
           <element name="unknown"><empty/></element>
           <group>
             <optional>
               <element name="audio"><empty/></element>
             </optional>
             <optional>
               <element name="text"><empty/></element>
             </optional>
             <optional>
               <element name="video"><empty/></element>
             </optional>
             <ref name="PrivacyExtension"/>
           </group>
         </choice>
         <ref name="commonAttributes"/>
       </element>
     </define>

     <!-- privacy extension point -->
     <define name="PrivacyExtension">
       <zeroOrMore>
         <ref name="anyRPID"/>
       </zeroOrMore>
     </define>

     <!-- relationship -->
     <define name="relationship">
       <element name="relationship">
         <zeroOrMore>
           <element name="note">
             <ref name="noteRPID"/>
           </element>
         </zeroOrMore>
         <choice>
           <element name="assistant"><empty/></element>
           <element name="associate"><empty/></element>
           <element name="family"><empty/></element>
           <element name="friend"><empty/></element>
           <zeroOrMore>
             <element name="other">
               <ref name="noteRPID"/>
             </element>
           </zeroOrMore>
           <element name="self"><empty/></element>



Urpalainen               Expires April 12, 2009                [Page 23]

Internet-Draft          Presence RELAX NG schemas           October 2008


           <element name="supervisor"><empty/></element>
           <element name="unknown"><empty/></element>
           <ref name="RelationshipExtension"/>
         </choice>
       </element>
     </define>

     <!-- relationship extension point -->
     <define name="RelationshipExtension">
       <oneOrMore>
         <ref name="anyRPID"/>
       </oneOrMore>
     </define>

     <!-- service-class -->
     <define name="service-class">
       <element name="service-class">
         <zeroOrMore>
           <element name="note">
             <ref name="noteRPID"/>
           </element>
         </zeroOrMore>
         <choice>
           <element name="courier"><empty/></element>
           <element name="electronic"><empty/></element>
           <element name="freight"><empty/></element>
           <element name="in-person"><empty/></element>
           <element name="postal"><empty/></element>
           <element name="unknown"><empty/></element>
           <ref name="ServiceClassExtension"/>
         </choice>
       </element>
     </define>

     <!-- service-class extension point -->
     <define name="ServiceClassExtension">
       <oneOrMore>
         <ref name="anyRPID"/>
       </oneOrMore>
     </define>

     <!-- sphere -->
     <define name="sphere">
       <element name="sphere">
         <mixed>
           <optional>
             <choice>
               <element name="home"><empty/></element>



Urpalainen               Expires April 12, 2009                [Page 24]

Internet-Draft          Presence RELAX NG schemas           October 2008


               <element name="work"><empty/></element>
               <element name="unknown"><empty/></element>
               <ref name="SphereExtension"/>
               </choice>
           </optional>
           <ref name="commonAttributes"/>
         </mixed>
       </element>
     </define>

     <!-- sphere extension point -->
     <define name="SphereExtension">
       <zeroOrMore>
         <ref name="anyRPID"/>
       </zeroOrMore>
     </define>

     <!-- status-icon -->
     <define name="status-icon">
       <element name="status-icon">
         <data type="anyURI"/>
         <ref name="commonAttributes"/>
       </element>
     </define>

     <!-- time-offset -->
     <define name="time-offset">
       <element name="time-offset">
         <data type="integer"/>

         <ref name="fromUntil"/>

         <optional>
           <attribute name="description"/>
         </optional>

         <optional>
           <attribute name="id">
             <data type="ID"/>
           </attribute>
         </optional>

         <zeroOrMore>
           <attribute>
             <anyName>
               <except>
                 <name ns="">description</name>
                 <name ns="">from</name>



Urpalainen               Expires April 12, 2009                [Page 25]

Internet-Draft          Presence RELAX NG schemas           October 2008


                 <name ns="">until</name>
                 <name ns="">id</name>
               </except>
             </anyName>
           </attribute>
         </zeroOrMore>

       </element>
     </define>

     <!-- user-input -->
     <define name="user-input">
       <element name="user-input">
         <optional>
           <attribute name="idle-threshold">
             <data type="positiveInteger"/>
           </attribute>
         </optional>

         <optional>
           <attribute name="last-input">
             <data type="dateTime"/>
           </attribute>
         </optional>

         <optional>
           <attribute name="id">
             <data type="ID"/>
           </attribute>
         </optional>

         <choice>
           <value type="string">active</value>
           <value type="string">idle</value>
         </choice>

         <zeroOrMore>
           <attribute>
             <anyName>
               <except>
                 <name ns="">idle-threshold</name>
                 <name ns="">last-input</name>
                 <name ns="">id</name>
               </except>
             </anyName>
           </attribute>
         </zeroOrMore>
       </element>



Urpalainen               Expires April 12, 2009                [Page 26]

Internet-Draft          Presence RELAX NG schemas           October 2008


     </define>

     <!-- fromUntil attributes -->
     <define name="fromUntil">
       <optional>
         <attribute name="from">
           <data type="dateTime"/>
         </attribute>
       </optional>
       <optional>
         <attribute name="until">
           <data type="dateTime"/>
         </attribute>
       </optional>
     </define>

     <!-- noteRPID element content -->
     <define name="noteRPID">
       <optional>
         <attribute>
           <name ns="http://www.w3.org/XML/1998/namespace">lang</name>
           <data type="language"/>
         </attribute>
       </optional>
       <data type="string"/>
     </define>
   </grammar>


   The RPID schema includes "data-model.rng" and the "anyDataModel"
   wildcard definition is redefined with "anyRPID".  There are many
   XXX"Extension" definitions.


7.  CIPID schema

   The RELAX NG version of the CIPID [RFC4482] schema, "cipid.rng":


   <?xml version="1.0"?>
   <grammar xmlns="http://relaxng.org/ns/structure/1.0"
     ns="urn:ietf:params:xml:ns:pidf:cipid"
     datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">

     <include href="rpid.rng">

       <!-- rule out data-model+pidf+rpid+cipid namespace -->
       <define name="anyRPID">



Urpalainen               Expires April 12, 2009                [Page 27]

Internet-Draft          Presence RELAX NG schemas           October 2008


         <ref name="anyCIPID"/>
       </define>

     </include>

     <!-- person extension definition -->
     <define name="PersonExtension" combine="interleave">
       <ref name="CIPID"/>
     </define>

     <!-- tuple extension definition -->
     <define name="TupleExtension" combine="interleave">
       <ref name="CIPID"/>
     </define>

     <!-- wildcarcd from other than
          pidf, data-model, rpid and cipid namespace -->
     <define name="anyCIPID">
       <element>
         <anyName>
           <except>
             <nsName ns="urn:ietf:params:xml:ns:pidf:cipid"/>
             <nsName ns="urn:ietf:params:xml:ns:pidf:rpid"/>
             <nsName ns="urn:ietf:params:xml:ns:pidf:data-model"/>
             <nsName ns="urn:ietf:params:xml:ns:pidf"/>
             <nsName ns=""/>
           </except>
         </anyName>
         <ref name="anyExtension"/>
        </element>
     </define>

     <!-- CIPID extension -->
     <define name="CIPID">
       <interleave>
         <optional>
           <element name="card">
             <data type="anyURI"/>
           </element>
         </optional>
         <zeroOrMore>
           <element name="display-name">
             <optional>
               <attribute>
                 <name ns="http://www.w3.org/XML/1998/namespace"
                       >lang</name>
                 <data type="language"/>
               </attribute>



Urpalainen               Expires April 12, 2009                [Page 28]

Internet-Draft          Presence RELAX NG schemas           October 2008


             </optional>
             <data type="string"/>
           </element>
         </zeroOrMore>
         <optional>
           <element name="icon">
             <data type="anyURI"/>
           </element>
         </optional>
         <optional>
           <element name="homepage">
             <data type="anyURI"/>
           </element>
         </optional>
         <optional>
           <element name="sound">
             <data type="anyURI"/>
           </element>
         </optional>
         <optional>
           <element name="map">
             <data type="anyURI"/>
           </element>
         </optional>
       </interleave>
     </define>

   </grammar>


   The CIPID schema includes "rpid.rng" and the "anyRPID" wildcard
   definition is redefined with "anyCIPID".


8.  CAPS schema

   The RELAX NG version of the CAPS [RFC5196] schema, "prescaps.rng":


 <?xml version="1.0"?>
 <grammar xmlns="http://relaxng.org/ns/structure/1.0"
   ns="urn:ietf:params:xml:ns:pidf:caps"
   datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">

   <include href="cipid.rng">

     <!-- rule out data-model+pidf+rpid+cipid+caps namespace -->
     <define name="anyCIPID">



Urpalainen               Expires April 12, 2009                [Page 29]

Internet-Draft          Presence RELAX NG schemas           October 2008


       <ref name="anyCaps"/>
     </define>

   </include>

   <!-- person extension definition -->
   <define name="DeviceExtension" combine="interleave">
     <ref name="devcaps"/>
   </define>

   <!-- wildcarcd from other than
        pidf, data-model, rpid, cipid and caps namespace -->
   <define name="anyCaps">
     <element>
       <anyName>
         <except>
           <nsName ns="urn:ietf:params:xml:ns:pidf:caps"/>
           <nsName ns="urn:ietf:params:xml:ns:pidf:cipid"/>
           <nsName ns="urn:ietf:params:xml:ns:pidf:rpid"/>
           <nsName ns="urn:ietf:params:xml:ns:pidf:data-model"/>
           <nsName ns="urn:ietf:params:xml:ns:pidf"/>
           <nsName ns=""/>
         </except>
       </anyName>
       <ref name="anyExtension"/>
     </element>
   </define>

   <!-- tuple extension definition -->
   <define name="TupleExtension" combine="interleave">
     <ref name="servcaps"/>
   </define>

   <define name="description">
     <element name="description">
       <data type="string"/>
       <optional>
         <attribute>
           <name ns="http://www.w3.org/XML/1998/namespace"
            >lang</name>
           <data type="language"/>
         </attribute>
       </optional>
     </element>
   </define>

   <!-- servcaps -->
   <define name="servcaps">



Urpalainen               Expires April 12, 2009                [Page 30]

Internet-Draft          Presence RELAX NG schemas           October 2008


     <optional>
       <element name="servcaps">
         <optional>
           <element name="actor">
             <optional>
               <element name="supported">
                 <ref name="actortypes"/>
               </element>
             </optional>
             <optional>
               <element name="notsupported">
                 <ref name="actortypes"/>
               </element>
             </optional>
           </element>
         </optional>
         <optional>
           <element name="application">
             <data type="boolean"/>
           </element>
         </optional>
         <optional>
           <element name="audio">
             <data type="boolean"/>
           </element>
         </optional>
         <optional>
           <element name="automata">
             <data type="boolean"/>
           </element>
         </optional>
         <optional>
           <element name="class">
             <optional>
               <element name="supported">
                 <ref name="classtypes"/>
               </element>
             </optional>
             <optional>
               <element name="notsupported">
                 <ref name="classtypes"/>
               </element>
             </optional>
           </element>
         </optional>
         <optional>
           <element name="control">
             <data type="boolean"/>



Urpalainen               Expires April 12, 2009                [Page 31]

Internet-Draft          Presence RELAX NG schemas           October 2008


           </element>
         </optional>
         <optional>
           <element name="data">
             <data type="boolean"/>
           </element>
         </optional>
         <zeroOrMore>
           <ref name="description"/>
         </zeroOrMore>
         <optional>
           <element name="duplex">
             <optional>
               <element name="supported">
                 <ref name="duplextypes"/>
               </element>
             </optional>
             <optional>
               <element name="notsupported">
                 <ref name="duplextypes"/>
               </element>
             </optional>
           </element>
         </optional>
         <optional>
           <element name="event-packages">
             <optional>
               <element name="supported">
                 <ref name="eventtypes"/>
               </element>
             </optional>
             <optional>
               <element name="notsupported">
                 <ref name="eventtypes"/>
               </element>
             </optional>
           </element>
         </optional>
         <optional>
           <element name="extensions">
             <optional>
               <element name="supported">
                 <ref name="extensiontypes"/>
               </element>
             </optional>
             <optional>
               <element name="notsupported">
                 <ref name="extensiontypes"/>



Urpalainen               Expires April 12, 2009                [Page 32]

Internet-Draft          Presence RELAX NG schemas           October 2008


               </element>
             </optional>
           </element>
         </optional>
         <optional>
           <element name="isfocus">
             <data type="boolean"/>
           </element>
         </optional>
         <optional>
           <element name="message">
             <data type="boolean"/>
           </element>
         </optional>
         <optional>
           <element name="methods">
             <optional>
               <element name="supported">
                 <ref name="methodtypes"/>
               </element>
             </optional>
             <optional>
               <element name="notsupported">
                 <ref name="methodtypes"/>
               </element>
             </optional>
           </element>
         </optional>
         <optional>
           <element name="languages">
             <optional>
               <element name="supported">
                 <oneOrMore>
                   <element name="l">
                     <data type="string"/>
                   </element>
                 </oneOrMore>
               </element>
             </optional>
             <optional>
               <element name="notsupported">
                 <oneOrMore>
                   <element name="l">
                     <data type="string"/>
                   </element>
                 </oneOrMore>
               </element>
             </optional>



Urpalainen               Expires April 12, 2009                [Page 33]

Internet-Draft          Presence RELAX NG schemas           October 2008


           </element>
         </optional>
         <optional>
           <element name="priority">
             <optional>
               <element name="supported">
                 <ref name="prioritytypes"/>
               </element>
             </optional>
             <optional>
               <element name="notsupported">
                 <ref name="prioritytypes"/>
               </element>
             </optional>
           </element>
         </optional>
         <optional>
           <element name="schemes">
             <optional>
               <element name="supported">
                 <oneOrMore>
                   <element name="s">
                     <data type="string"/>
                   </element>
                 </oneOrMore>
               </element>
             </optional>
             <optional>
               <element name="notsupported">
                 <oneOrMore>
                   <element name="s">
                     <data type="string"/>
                   </element>
                 </oneOrMore>
               </element>
             </optional>
           </element>
         </optional>
         <optional>
           <element name="text">
             <data type="boolean"/>
           </element>
         </optional>
         <zeroOrMore>
           <element name="type">
             <data type="string"/>
           </element>
         </zeroOrMore>



Urpalainen               Expires April 12, 2009                [Page 34]

Internet-Draft          Presence RELAX NG schemas           October 2008


         <optional>
           <element name="video">
             <data type="boolean"/>
           </element>
         </optional>
         <zeroOrMore>
           <ref name="anyCaps"/>
         </zeroOrMore>
         <zeroOrMore>
           <attribute>
             <anyName/>
           </attribute>
         </zeroOrMore>
       </element>
     </optional>
   </define>

   <!-- duplextypes -->
   <define name="duplextypes">
     <optional>
       <element name="full"><data type="string"/></element>
     </optional>
     <optional>
       <element name="half"><data type="string"/></element>
     </optional>
     <optional>
       <element name="receive-only"><data type="string"/></element>
     </optional>
     <optional>
       <element name="send-only"><data type="string"/></element>
     </optional>
     <zeroOrMore>
       <ref name="anyCaps"/>
     </zeroOrMore>
   </define>

   <!-- eventtypes -->
   <define name="eventtypes">
     <optional>
       <element name="conference"><data type="string"/></element>
     </optional>
     <optional>
       <element name="dialog"><data type="string"/></element>
     </optional>
     <optional>
       <element name="kpml"><data type="string"/></element>
     </optional>
     <optional>



Urpalainen               Expires April 12, 2009                [Page 35]

Internet-Draft          Presence RELAX NG schemas           October 2008


       <element name="message-summary"><data type="string"/></element>
     </optional>
     <optional>
       <element name="poc-settings"><data type="string"/></element>
     </optional>
     <optional>
       <element name="presence"><data type="string"/></element>
     </optional>
     <optional>
       <element name="reg"><data type="string"/></element>
     </optional>
     <optional>
       <element name="refer"><data type="string"/></element>
     </optional>
     <optional>
       <element name="Siemens-RTP-Stats"><data type="string"/></element>
     </optional>
     <optional>
       <element name="spirits-INDPs"><data type="string"/></element>
     </optional>
     <optional>
       <element name="spirits-user-prof"><data type="string"/></element>
     </optional>
     <optional>
       <element name="winfo"><data type="string"/></element>
     </optional>
     <zeroOrMore>
       <ref name="anyCaps"/>
     </zeroOrMore>
   </define>

   <!-- extensiontypes -->
   <define name="extensiontypes">
     <optional>
       <element name="rel100"><data type="string"/></element>
     </optional>
     <optional>
       <element name="early-session"><data type="string"/></element>
     </optional>
     <optional>
       <element name="eventlist"><data type="string"/></element>
     </optional>
     <optional>
       <element name="from-change"><data type="string"/></element>
     </optional>
     <optional>
       <element name="gruu"><data type="string"/></element>
     </optional>



Urpalainen               Expires April 12, 2009                [Page 36]

Internet-Draft          Presence RELAX NG schemas           October 2008


     <optional>
       <element name="hist-info"><data type="string"/></element>
     </optional>
     <optional>
       <element name="join"><data type="string"/></element>
     </optional>
     <optional>
       <element name="norefersub"><data type="string"/></element>
     </optional>
     <optional>
       <element name="path"><data type="string"/></element>
     </optional>
     <optional>
       <element name="precondition"><data type="string"/></element>
     </optional>
     <optional>
       <element name="pref"><data type="string"/></element>
     </optional>
     <optional>
       <element name="privacy"><data type="string"/></element>
     </optional>
     <optional>
       <element name="recipient-list-invite">
         <data type="string"/></element>
     </optional>
     <optional>
       <element name="recipient-list-subscribe">
         <data type="string"/></element>
     </optional>
     <optional>
       <element name="replaces"><data type="string"/></element>
     </optional>
     <optional>
       <element name="resource-priority"><data type="string"/></element>
     </optional>
     <optional>
       <element name="sdp-anat"><data type="string"/></element>
     </optional>
     <optional>
       <element name="sec-agree"><data type="string"/></element>
     </optional>
     <optional>
       <element name="tdialog"><data type="string"/></element>
     </optional>
     <optional>
       <element name="timer"><data type="string"/></element>
     </optional>
     <zeroOrMore>



Urpalainen               Expires April 12, 2009                [Page 37]

Internet-Draft          Presence RELAX NG schemas           October 2008


       <ref name="anyCaps"/>
     </zeroOrMore>
   </define>

   <!-- classtypes -->
   <define name="classtypes">
     <optional>
       <element name="business"><data type="string"/></element>
     </optional>
     <optional>
       <element name="personal"><data type="string"/></element>
     </optional>
     <zeroOrMore>
       <ref name="anyCaps"/>
     </zeroOrMore>
   </define>

   <!-- actortypes -->
   <define name="actortypes">
     <optional>
       <element name="attendant"><data type="string"/></element>
     </optional>
     <optional>
       <element name="information"><data type="string"/></element>
     </optional>
     <optional>
       <element name="msg-taker"><data type="string"/></element>
     </optional>
     <optional>
       <element name="principal"><data type="string"/></element>
     </optional>
     <zeroOrMore>
       <ref name="anyCaps"/>
     </zeroOrMore>
   </define>

   <!-- methodtypes -->
   <define name="methodtypes">
     <optional>
       <element name="ACK"><data type="string"/></element>
     </optional>
     <optional>
       <element name="BYE"><data type="string"/></element>
     </optional>
     <optional>
       <element name="CANCEL"><data type="string"/></element>
     </optional>
     <optional>



Urpalainen               Expires April 12, 2009                [Page 38]

Internet-Draft          Presence RELAX NG schemas           October 2008


       <element name="INFO"><data type="string"/></element>
     </optional>
     <optional>
       <element name="INVITE"><data type="string"/></element>
     </optional>
     <optional>
       <element name="MESSAGE"><data type="string"/></element>
     </optional>
     <optional>
       <element name="NOTIFY"><data type="string"/></element>
     </optional>
     <optional>
       <element name="OPTIONS"><data type="string"/></element>
     </optional>
     <optional>
       <element name="PRACK"><data type="string"/></element>
     </optional>
     <optional>
       <element name="PUBLISH"><data type="string"/></element>
     </optional>
     <optional>
       <element name="REFER"><data type="string"/></element>
     </optional>
     <optional>
       <element name="REGISTER"><data type="string"/></element>
     </optional>
     <optional>
       <element name="SUBSCRIBE"><data type="string"/></element>
     </optional>
     <optional>
       <element name="UPDATE"><data type="string"/></element>
     </optional>
     <zeroOrMore>
       <ref name="anyCaps"/>
     </zeroOrMore>
   </define>

   <!-- devcaps -->
   <define name="devcaps">
     <optional>
       <element name="devcaps">
         <zeroOrMore>
           <ref name="description"/>
         </zeroOrMore>
         <optional>
           <element name="mobility">
             <optional>
               <element name="supported">



Urpalainen               Expires April 12, 2009                [Page 39]

Internet-Draft          Presence RELAX NG schemas           October 2008


                 <ref name="mobilitytypes"/>
               </element>
             </optional>
             <optional>
               <element name="notsupported">
                 <ref name="mobilitytypes"/>
               </element>
             </optional>
           </element>
         </optional>
         <zeroOrMore>
           <ref name="anyCaps"/>
         </zeroOrMore>
         <zeroOrMore>
           <attribute>
             <anyName/>
           </attribute>
         </zeroOrMore>
       </element>
     </optional>
   </define>

   <!-- prioritytypes -->
   <define name="prioritytypes">
     <zeroOrMore>
       <element name="equals">
         <attribute name="value">
           <data type="integer"/>
         </attribute>
       </element>
     </zeroOrMore>

     <zeroOrMore>
       <element name="higherhan">
         <attribute name="minvalue">
           <data type="integer"/>
         </attribute>
       </element>
     </zeroOrMore>

     <zeroOrMore>
       <element name="lowerthan">
         <attribute name="maxvalue">
           <data type="integer"/>
         </attribute>
       </element>
     </zeroOrMore>




Urpalainen               Expires April 12, 2009                [Page 40]

Internet-Draft          Presence RELAX NG schemas           October 2008


     <zeroOrMore>
       <element name="range">
         <attribute name="maxvalue">
           <data type="integer"/>
         </attribute>
         <attribute name="minvalue">
           <data type="integer"/>
         </attribute>
       </element>
     </zeroOrMore>
     <zeroOrMore>
       <ref name="anyCaps"/>
     </zeroOrMore>
   </define>

   <!-- mobilitytypes -->
   <define name="mobilitytypes">
     <optional>
       <element name="fixed">
         <data type="string"/>
       </element>
     </optional>
     <optional>
       <element name="mobile">
         <data type="string"/>
       </element>
     </optional>
     <zeroOrMore>
       <ref name="anyCaps"/>
     </zeroOrMore>
   </define>
 </grammar>


   The "anyCIPID" wildcard definition is redefined with "anyCaps".


9.  Location Types schema

   The RELAX NG version of the LocationTypes [RFC4589] schema, "lt.rng":


<?xml version="1.0"?>
<grammar xmlns="http://relaxng.org/ns/structure/1.0"
  ns="urn:ietf:params:xml:ns:location-type"
  datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">

  <include href="prescaps.rng">



Urpalainen               Expires April 12, 2009                [Page 41]

Internet-Draft          Presence RELAX NG schemas           October 2008


    <!-- rule out data-model+pidf+rpid+cipid+caps+location-type
         namespaces -->
    <define name="anyCaps">
      <ref name="anyLocationTypes"/>
    </define>

  </include>

  <!-- placetype extension definition -->
  <define name="PlaceTypeExtension" combine="choice">
    <ref name="placetypes"/>
  </define>

  <!-- wildcarcd from other than
       pidf, data-model, rpid, cipid, caps and
       location-type namespace -->
  <define name="anyLocationTypes">
    <element>
      <anyName>
        <except>
          <nsName ns="urn:ietf:params:xml:ns:location-type"/>
          <nsName ns="urn:ietf:params:xml:ns:pidf:caps"/>
          <nsName ns="urn:ietf:params:xml:ns:pidf:cipid"/>
          <nsName ns="urn:ietf:params:xml:ns:pidf:rpid"/>
          <nsName ns="urn:ietf:params:xml:ns:pidf:data-model"/>
          <nsName ns="urn:ietf:params:xml:ns:pidf"/>
          <nsName ns=""/>
        </except>
      </anyName>
      <ref name="anyExtension"/>
     </element>
  </define>

  <!-- servcaps -->
  <define name="placetypes">
     <choice>
       <element name="aircraft"><empty/></element>
       <element name="airport"><empty/></element>
       <element name="arena"><empty/></element>
       <element name="automobile"><empty/></element>
       <element name="bank"><empty/></element>
       <element name="bar"><empty/></element>
       <element name="bicycle"><empty/></element>
       <element name="bus"><empty/></element>
       <element name="bus-station"><empty/></element>
       <element name="cafe"><empty/></element>
       <element name="classroom"><empty/></element>
       <element name="club"><empty/></element>



Urpalainen               Expires April 12, 2009                [Page 42]

Internet-Draft          Presence RELAX NG schemas           October 2008


       <element name="construction"><empty/></element>
       <element name="convention-center"><empty/></element>
       <element name="government"><empty/></element>
       <element name="hospital"><empty/></element>
       <element name="hotel"><empty/></element>
       <element name="industrial"><empty/></element>
       <element name="library"><empty/></element>
       <element name="office"><empty/></element>
       <element name="other">
         <optional>
           <attribute>
             <name ns="http://www.w3.org/XML/1998/namespace">lang</name>
             <data type="language"/>
           </attribute>
         </optional>
         <data type="string"/>
       </element>
       <element name="outdoors"><empty/></element>
       <element name="parking"><empty/></element>
       <element name="place-of-worship"><empty/></element>
       <element name="prison"><empty/></element>
       <element name="public"><empty/></element>
       <element name="public-transport"><empty/></element>
       <element name="residence"><empty/></element>
       <element name="restaurant"><empty/></element>
       <element name="school"><empty/></element>
       <element name="shopping-area"><empty/></element>
       <element name="stadium"><empty/></element>
       <element name="store"><empty/></element>
       <element name="street"><empty/></element>
       <element name="theater"><empty/></element>
       <element name="train"><empty/></element>
       <element name="train-station"><empty/></element>
       <element name="truck"><empty/></element>
       <element name="underway"><empty/></element>
       <element name="unknown"><empty/></element>
       <element name="warehouse"><empty/></element>
       <element name="water"><empty/></element>
       <element name="watercraft"><empty/></element>
     </choice>
   </define>
 </grammar>


   The "anyCaps" wildcard definition is redefined with
   "anyLocationTypes".





Urpalainen               Expires April 12, 2009                [Page 43]

Internet-Draft          Presence RELAX NG schemas           October 2008


10.  Timed Status schema

   The RELAX NG version of the TimedStatus [RFC4480] schema, "ts.rng":


   <?xml version="1.0"?>
   <grammar xmlns="http://relaxng.org/ns/structure/1.0"
       ns="urn:ietf:params:xml:ns:pidf:timed-status"
       datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">

     <include href="lt.rng"/>

     <!-- new tuple extension definition -->
     <define name="TupleExtension" combine="interleave">
       <ref name="TimedStatus"/>
     </define>

     <define name="TimedStatus">
       <optional>
         <element name="timed-status">
           <attribute name="from">
             <data type="dateTime"/>
           </attribute>

           <optional>
             <attribute name="until">
               <data type="dateTime"/>
             </attribute>
           </optional>

           <optional>
             <element name="basic">
               <choice>
                 <value type="string">open</value>
                 <value type="string">closed</value>
               </choice>
             </element>
           </optional>

           <optional>
             <element name="note">
               <optional>
                 <attribute>
                   <name ns="http://www.w3.org/XML/1998/namespace"
                        >lang</name>
                   <data type="language"/>
                 </attribute>
               </optional>



Urpalainen               Expires April 12, 2009                [Page 44]

Internet-Draft          Presence RELAX NG schemas           October 2008


               <data type="string"/>
             </element>
           </optional>

           <ref name="TimedStatusExtension"/>

         </element>
       </optional>

     </define>

     <!-- extension point with interleave for status -->
     <define name="TimedStatusExtension">
       <zeroOrMore>
         <ref name="anyTimedStatus"/>
       </zeroOrMore>
     </define>

     <!-- wildcard for other than timed-status namespace -->
     <define name="anyTimedStatus">
       <element>
         <anyName>
           <except>
             <nsName ns="urn:ietf:params:xml:ns:pidf:timed-status"/>
             <nsName ns=""/>
           </except>
         </anyName>
         <ref name="anyExtension"/>
       </element>
     </define>

   </grammar>



11.  An example instance document

   An example instance document:

   <?xml version="1.0" encoding="UTF-8"?>
   <presence xmlns="urn:ietf:params:xml:ns:pidf"
     xmlns:dm="urn:ietf:params:xml:ns:pidf:data-model"
     xmlns:rpid="urn:ietf:params:xml:ns:pidf:rpid"
     xmlns:ci="urn:ietf:params:xml:ns:pidf:cipid"
     xmlns:caps="urn:ietf:params:xml:ns:pidf:caps"
     xmlns:lt="urn:ietf:params:xml:ns:location-type"
     entity="pres:someone@example.com">




Urpalainen               Expires April 12, 2009                [Page 45]

Internet-Draft          Presence RELAX NG schemas           October 2008


     <tuple id="bs35r9">
       <status>
         <basic>open</basic>
       </status>
       <dm:deviceID>urn:device:0003ba4811e3</dm:deviceID>
       <rpid:relationship><rpid:self/></rpid:relationship>
       <rpid:service-class><rpid:electronic/></rpid:service-class>
       <caps:servcaps>
         <caps:audio>true</caps:audio>
         <caps:description>
              Example service
         </caps:description>
         <caps:duplex>
           <caps:supported>
             <caps:full/>
           </caps:supported>
         </caps:duplex>
         <caps:message>1</caps:message>
         <caps:methods>
           <caps:supported>
             <caps:ACK/>
             <caps:BYE/>
             <caps:INVITE/>
           </caps:supported>
         </caps:methods>
         <caps:priority>
           <caps:supported>
             <caps:lowerthan maxvalue="10"/>
           </caps:supported>
         </caps:priority>
         <caps:schemes>
           <caps:supported>
             <caps:s>sip</caps:s>
           </caps:supported>
         </caps:schemes>
         <caps:video>false</caps:video>
       </caps:servcaps>
       <contact priority="0.8">im:someone@mobile.example.net</contact>
       <note xml:lang="en">Don't Disturb Please!</note>
       <note xml:lang="fr">Ne derangez pas, s'il vous plait</note>
       <timestamp>2001-10-27T16:49:29Z</timestamp>
     </tuple>

     <tuple id="ty4658">
       <status>
         <basic>open</basic>
       </status>
       <rpid:relationship><rpid:assistant/></rpid:relationship>



Urpalainen               Expires April 12, 2009                [Page 46]

Internet-Draft          Presence RELAX NG schemas           October 2008


       <contact priority="1.0">mailto:secretary@example.com</contact>
     </tuple>

     <tuple id="eg92n8">
       <status>
         <basic>open</basic>
       </status>
       <dm:deviceID>urn:x-mac:0003ba4811e3</dm:deviceID>
       <rpid:class>email</rpid:class>
       <rpid:service-class><rpid:electronic/></rpid:service-class>
       <rpid:status-icon
         >http://www.example.com/mailbox.png</rpid:status-icon>
       <contact priority="1.0">mailto:someone@example.com</contact>
     </tuple>

     <note>I'll be in Tokyo next week</note>

     <dm:device id="pc147">
       <rpid:user-input idle-threshold="600"
         last-input="2004-10-21T13:20:00.000-05:00"
         >idle</rpid:user-input>
       <caps:devcaps>
         <caps:mobility>
           <caps:supported>
             <caps:mobile/>
           </caps:supported>
         </caps:mobility>
       </caps:devcaps>
       <dm:deviceID>urn:device:0003ba4811e3</dm:deviceID>
       <dm:note>PC</dm:note>
     </dm:device>

     <dm:person id="p1">
       <rpid:activities from="2005-05-30T12:00:00+05:00"
                        until="2005-05-30T17:00:00+05:00">
         <rpid:note>Far away</rpid:note>
         <rpid:other xml:lang="en">Don't Disturb Please!</rpid:other>
         <rpid:other xml:lang="fi">hoepoen hoepoen</rpid:other>
         <rpid:away/>
       </rpid:activities>
       <rpid:class>calendar</rpid:class>
       <rpid:mood><rpid:angry/></rpid:mood>
       <rpid:place-is>
          <rpid:audio>
             <rpid:noisy/>
          </rpid:audio>
       </rpid:place-is>
       <rpid:place-type><lt:hotel/></rpid:place-type>



Urpalainen               Expires April 12, 2009                [Page 47]

Internet-Draft          Presence RELAX NG schemas           October 2008


       <rpid:privacy><rpid:unknown/></rpid:privacy>
       <rpid:sphere>bowling league</rpid:sphere>
       <rpid:status-icon
         >http://www.example.com/playing.gif</rpid:status-icon>
       <rpid:time-offset>-240</rpid:time-offset>

       <ci:card>http://example.com/~someone/card.vcd</ci:card>
       <ci:homepage>http://example.com/~someone</ci:homepage>
       <ci:icon>http://example.com/~someone/icon.gif</ci:icon>
       <ci:map>http://example.com/~someone/gml-map.xml</ci:map>
       <ci:sound>http://example.com/~someone/whoosh.wav</ci:sound>
       <dm:timestamp>2005-05-30T16:09:44+05:00</dm:timestamp>
     </dm:person>
   </presence>


   This instance document can be validated with the described PIDF, PIDF
   + DataModel, PIDF + DataModel + RPID, PIDF + DataModel + RPID +
   CIPID, PIDF + DataModel + RPID + CIPID + CAPS, PIDF + DataModel +
   RPID + CIPID + CAPS + LocationTypes or PIDF + DataModel + RPID +
   CIPID + CAPS + LocationTypes + TimedStatus schemas.  The wildcard
   definitions can be disabled when using e.g. the CAPS schema as there
   are no "private" extensions.  Likewise a simple basic PIDF instance
   document can be validated with all of these schema combinations.
   This shows how forwards and backwards compatible schemas work in
   practice, only the level of scrutiny changes.

   It is worth noting that the ordering of the extension child elements
   of the <tuple> element can interchange.  This applies to the <person>
   element extensions as well.  The "interleave" definition allows
   unordered content.


12.  Security considerations

   Information transported within these documents can be highly
   sensitive.  All the security considerations described in PIDF and
   extension documents applies to this as well.


13.  Acknowledgments

   The author would like to thank Aki Niemi, Pekka Pessi and Eva-Maria
   Leppanen for their valuable comments.


14.  References




Urpalainen               Expires April 12, 2009                [Page 48]

Internet-Draft          Presence RELAX NG schemas           October 2008


14.1.  Normative references

   [RFC2119]  Bradner, S., "Key words for use in RFCs to Indicate
              Requirement Levels", BCP 14, RFC 2119, March 1997.

   [W3C.REC-xml-20060816]
              Maler, E., Paoli, J., Bray, T., Yergeau, F., and C.
              Sperberg-McQueen, "Extensible Markup Language (XML) 1.0
              (Fourth Edition)", World Wide Web Consortium
              Recommendation REC-xml-20060816, August 2006,
              <http://www.w3.org/TR/2006/REC-xml-20060816>.

   [W3C.REC-xmlschema-1-20041028]
              Beech, D., Thompson, H., Maloney, M., and N. Mendelsohn,
              "XML Schema Part 1: Structures Second Edition", World Wide
              Web Consortium Recommendation REC-xmlschema-1-20041028,
              October 2004,
              <http://www.w3.org/TR/2004/REC-xmlschema-1-20041028>.

   [W3C.REC-xmlschema-2-20041028]
              Malhotra, A. and P. Biron, "XML Schema Part 2: Datatypes
              Second Edition", World Wide Web Consortium
              Recommendation REC-xmlschema-2-20041028, October 2004,
              <http://www.w3.org/TR/2004/REC-xmlschema-2-20041028>.

   [relaxng]  "RELAX NG Specification", Committee Specification 3 ,
              December 2001.

   [RFC3863]  Sugano, H., Fujimoto, S., Klyne, G., Bateman, A., Carr,
              W., and J. Peterson, "Presence Information Data Format
              (PIDF)", RFC 3863, August 2004.

   [RFC4479]  Rosenberg, J., "A Data Model for Presence", RFC 4479,
              July 2006.

   [RFC4480]  Schulzrinne, H., Gurbani, V., Kyzivat, P., and J.
              Rosenberg, "RPID: Rich Presence Extensions to the Presence
              Information Data Format (PIDF)", RFC 4480, July 2006.

   [RFC4481]  Schulzrinne, H., "Timed Presence Extensions to the
              Presence Information Data Format (PIDF) to Indicate Status
              Information for Past and Future Time Intervals", RFC 4481,
              July 2006.

   [RFC4482]  Schulzrinne, H., "CIPID: Contact Information for the
              Presence Information Data Format", RFC 4482, July 2006.

   [RFC4589]  Schulzrinne, H. and H. Tschofenig, "Location Types



Urpalainen               Expires April 12, 2009                [Page 49]

Internet-Draft          Presence RELAX NG schemas           October 2008


              Registry", RFC 4589, July 2006.

   [RFC5196]  Lonnfors, M. and K. Kiss, "Session Initiation Protocol
              (SIP) User Agent Capability Extension to Presence
              Information Data Format (PIDF)", RFC 5196, September 2008.

14.2.  Informative references

   [RFC3859]  Peterson, J., "Common Profile for Presence (CPP)",
              RFC 3859, August 2004.


Author's Address

   Jari Urpalainen
   Nokia
   Itamerenkatu 11-13
   Helsinki  00180
   Finland

   Phone: +358 7180 37686
   Email: jari.urpalainen@nokia.com





























Urpalainen               Expires April 12, 2009                [Page 50]

Internet-Draft          Presence RELAX NG schemas           October 2008


Full Copyright Statement

   Copyright (C) The IETF Trust (2008).

   This document is subject to the rights, licenses and restrictions
   contained in BCP 78, and except as set forth therein, the authors
   retain all their rights.

   This document and the information contained herein are provided on an
   "AS IS" basis and THE CONTRIBUTOR, THE ORGANIZATION HE/SHE REPRESENTS
   OR IS SPONSORED BY (IF ANY), THE INTERNET SOCIETY, THE IETF TRUST AND
   THE INTERNET ENGINEERING TASK FORCE DISCLAIM ALL WARRANTIES, EXPRESS
   OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF
   THE INFORMATION HEREIN WILL NOT INFRINGE ANY RIGHTS OR ANY IMPLIED
   WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.


Intellectual Property

   The IETF takes no position regarding the validity or scope of any
   Intellectual Property Rights or other rights that might be claimed to
   pertain to the implementation or use of the technology described in
   this document or the extent to which any license under such rights
   might or might not be available; nor does it represent that it has
   made any independent effort to identify any such rights.  Information
   on the procedures with respect to rights in RFC documents can be
   found in BCP 78 and BCP 79.

   Copies of IPR disclosures made to the IETF Secretariat and any
   assurances of licenses to be made available, or the result of an
   attempt made to obtain a general license or permission for the use of
   such proprietary rights by implementers or users of this
   specification can be obtained from the IETF on-line IPR repository at
   http://www.ietf.org/ipr.

   The IETF invites any interested party to bring to its attention any
   copyrights, patents or patent applications, or other proprietary
   rights that may cover technology that may be required to implement
   this standard.  Please address the information to the IETF at
   ietf-ipr@ietf.org.











Urpalainen               Expires April 12, 2009                [Page 51]