6 Appendix A: Full text/xml+msrtc.pidf Presence Document Format

 <?xml version="1.0" ?>
 <xs:schema id="presence" version="2.0" 
  targetNamespace="http://schemas.microsoft.com/09/2002/sip/presence" 
  elementFormDefault="qualified"
  xmlns:tns="http://schemas.microsoft.com/09/2002/sip/presence" 
  xmlns:xs="http://www.w3.org/2001/XMLSchema" 
  xmlns:ct="http://schemas.microsoft.com/sip/types">
  
   <xs:annotation>
     <xs:documentation>
       Live Communications Server 2005 provides Instant Messaging 
       and presence capabilities amongst users in an enterprise. A 
       user can login using multiple devices. Each device presents 
       its presence information to the server. The XML instance 
       containing presence submitted to the server is called the 
       Presence Document. When retrieving presence information for 
       a user, the server not only returns the presence document 
       from every device, but it also determines the overall presence 
       of the user. This XML instance returned by the server is 
       called the Aggregated Presence Document.
  
       This schema describes the structure of both the Presence 
       Document consumed by the server as well as the Aggregated 
       Presence Document generated by the server.
     </xs:documentation>
   </xs:annotation>
  
   <xs:import namespace="http://schemas.microsoft.com/sip/types" 
              schemaLocation="common.xsd" />
  
   <!-- Common Types -->
  
   <xs:simpleType name="aggregate">
     <xs:restriction base="xs:nonNegativeInteger">
       <xs:minInclusive value="0" />
       <xs:maxInclusive value="999" />
     </xs:restriction>
   </xs:simpleType>
  
   <xs:simpleType name="epid">
     <xs:annotation>
       <xs:documentation>
         Each device of a user is uniquely identified by its epid.
         This value cannot exceed 16 bytes.
       </xs:documentation>
     </xs:annotation>
     <xs:restriction base="xs:token" />
   </xs:simpleType>
  
   <xs:simpleType name="ageOfPresence">
     <xs:annotation>
       <xs:documentation>
         This is the number of seconds since the device last updated
         its presence information
       </xs:documentation>
     </xs:annotation>
     <xs:restriction base="xs:nonNegativeInteger" />
   </xs:simpleType>
  
   <xs:complexType name="availability">
     <xs:annotation>
       <xs:documentation>
         The purpose of availability is to indicate whether the user
         can receive a call.
       </xs:documentation>
     </xs:annotation>
  
     <xs:attribute 
        name="aggregate" type="tns:aggregate" use="required" >
       <xs:annotation>
         <xs:documentation>
           The value of the aggregate attribute defines the 
           availability of a user on a device. The aggregate values
           are processed by the server as being within a range that 
           has a span of 100 (class code). The server interprets 
           the values as falling within the following classes (with 
           their corresponding interpretations):
  
           000-099
             The user cannot receive calls.
           100-199
             The user may be online but availability is unknown 
             until a call is attempted. A cell phone gateway would 
             typically use this setting.
           200-299
             The user has a device that is currently connected and 
             can receive calls.
           300-399
             The user is in the proximity of a device that can 
             receive calls.
  
           Rather than using a hard-coded enumeration a numeric 
           value is value.  This makes it easy to compare the 
           availability sent by two different PUAs.
         </xs:documentation>
       </xs:annotation>
     </xs:attribute>
  
     <xs:attribute name="description" type="xs:string" >
       <xs:annotation>
         <xs:documentation>
           The server always returns an empty string in the 
           aggregated presence document.
         </xs:documentation>
       </xs:annotation>
     </xs:attribute>
  
     <xs:attribute name="epid" type="tns:epid" />
   </xs:complexType>
  
   <xs:complexType name="activity">
     <xs:annotation>
       <xs:documentation>
         The purpose of activity is to indicate not whether a user 
         can receive a call, but rather, to indicate to watchers 
         how likely the user is to want to be disturbed.
       </xs:documentation>
     </xs:annotation>
  
     <xs:attribute name="aggregate" 
                   type="tns:aggregate" use="required" >
       <xs:annotation>
         <xs:documentation>
           000 - 099        There is no information about the 
                             activity of the user
           100 - 149        The user is away
           150 - 199        The user is out to lunch
           200 - 299        The user is idle
           300 - 399        The user will be right back
           400 - 499        The user is active
           500 - 599        The user is already participating in a
                             communications session
           600 - 699        The user is busy
           700 - 799        The user is away
           800 - 999        The user is active
  
           Rather than using a hard-coded enumeration a numeric value
           is value.  This makes it easy to compare the activity sent
           by two different PUAs.
         </xs:documentation>
       </xs:annotation>
     </xs:attribute>
  
     <xs:attribute name="description" type="xs:string" >
       <xs:annotation>
         <xs:documentation>
           The server always returns an empty string in the aggregated
           presence document.
         </xs:documentation>
       </xs:annotation>
     </xs:attribute>
  
     <xs:attribute name="epid" type="tns:epid" />
  
     <xs:attribute name="note" type="xs:string" >
       <xs:annotation>
         <xs:documentation>
           This attribute can be used by the client to store a string 
           indicating the user's status on the device.
         </xs:documentation>
       </xs:annotation>
     </xs:attribute>
   </xs:complexType>
  
   <xs:complexType name="userInfo">
     <xs:annotation>
       <xs:documentation>
         This element is used for storing persisted presence 
         information for a user. This information is stored by the 
         server and is available regardless of the device a user is 
         logged in and / or whether the user is logged in or not. Any 
         valid XML can be stored by the client. The server enforces a 
         limit of 1024 characters on the size of the element body, 
         where the entire element body is treated as a single string.
       </xs:documentation>
     </xs:annotation>
  
     <xs:sequence>
       <xs:any namespace="##any" processContents="lax" 
               minOccurs="0" maxOccurs="unbounded" />
     </xs:sequence>
   </xs:complexType>
  
   <xs:group name="presenceDocInfo">
     <xs:sequence>
       <xs:element name="availability" type="tns:availability" />
       <xs:element name="activity" type="tns:activity" />
       <xs:element name="userInfo" type="tns:userInfo" />
  
       <xs:any 
         namespace="##any" 
         processContents="lax" 
         minOccurs="0" 
         maxOccurs="unbounded" />
     </xs:sequence>
   </xs:group>
  
   <!-- Presence document consumed by the server -->
  
   <xs:complexType name="presenceDoc">
     <xs:annotation>
       <xs:documentation>
         The containing element and its contents are collectively 
         called the presence document. The document describes a 
         user's availability on a particular device. This is the 
         document sent from a Presence User Agent that intends to 
         publish its presence.
       </xs:documentation>
     </xs:annotation>
  
     <xs:sequence>
       <xs:group ref="tns:presenceDocInfo" />
     </xs:sequence>
  
     <xs:attribute name="uri" type="ct:sipURI" use="required" />
   </xs:complexType>
  
   <!-- Aggregated Presence document generated by the server -->
  
   <xs:complexType name="aggregatedPresenceDoc">
     <xs:annotation>
       <xs:documentation>
         The containing element and its contents are collectively 
         called the aggregated presence document. The document 
         describes a user's availability on all its devices as well 
         as an overall aggregated presence. This is the document 
         published by the server to anyone obtaining the presence of 
         a particular user.
       </xs:documentation>
     </xs:annotation>
  
     <xs:sequence>
       <xs:element name="availability" type="tns:availability" >
         <xs:annotation>
           <xs:documentation>
             This is the availability information from the most 
             available device.
           </xs:documentation>
         </xs:annotation>
       </xs:element>
  
       <xs:element name="activity" type="tns:activity" >
         <xs:annotation>
           <xs:documentation>
             This is the activity information from 
             the most available device.
           </xs:documentation>
         </xs:annotation>
       </xs:element>
  
       <xs:element name="displayName" >
         <xs:complexType>
           <xs:attribute name="displayName" type="ct:displayName" />
         </xs:complexType>
       </xs:element>
  
       <xs:element name="email">
         <xs:complexType>
           <xs:attribute name="email" type="ct:email" />
         </xs:complexType>
       </xs:element>
  
       <xs:element name="phoneNumber">
         <xs:complexType>
           <xs:attribute 
             name="label" 
             type="xs:string" 
             use="required">
             <xs:annotation>
               <xs:documentation>
                 This string is always empty.
               </xs:documentation>
             </xs:annotation>
           </xs:attribute>
  
           <xs:attribute 
             name="number" 
             type="ct:phone" 
             use="required" />
         </xs:complexType>
       </xs:element>
  
       <xs:element 
         name="userInfo" 
         type="tns:userInfo" />
  
       <xs:element name="devices">
         <xs:complexType>
           <xs:sequence>
             <xs:element 
               name="devicePresence" 
               maxOccurs="unbounded" >
               <xs:complexType>
                 <xs:sequence>
                   <xs:group ref="tns:presenceDocInfo" />
                 </xs:sequence>
  
                 <xs:attribute name="epid" type="tns:epid" />
                 <xs:attribute name="ageOfPresence" 
                               type="tns:ageOfPresence" 
                               use="required" />
               </xs:complexType>
             </xs:element>
           </xs:sequence>
         </xs:complexType>
       </xs:element>
     </xs:sequence>
  
     <xs:attribute name="uri" type="ct:sipURI" use="required"/>
   </xs:complexType>
  
   <xs:element name="presentity" type="tns:aggregatedPresenceDoc"/>
 </xs:schema>