<?xml version="1.0" encoding="UTF-8"?>
<!-- 
XDM - XDM Preferences Schema
	version - 1.0.1
	date    - 03 May 2016

FILE INFORMATION

	OMA Permanent Document
	   File: OMA-SUP-XSD_xdm_xdmPreferences-V1_0_1-20160503-A
	   Type: Text - Schema Description

	Public Reachable Information
	   Path: http://www.openmobilealliance.org/tech/profiles
	   Name: xdm_xdmPreferences-v1_0.xsd

NORMATIVE INFORMATION

	Information about this file can be found in the specification
	
	   OMA-TS-XDM_Core-V2_2
		
	available at http://www.openmobilealliance.org/

	Send comments to technical-comments@mail.openmobilealliance.org
	
CHANGE HISTORY

03052016 Status changed to Approved by TP, TP Ref # OMA-TP-2016-0052R01-INP_XDM_V2_2_ERP_for_final_Approval

LEGAL DISCLAIMER

  Copyright 2016 Open Mobile Alliance Ltd.  All rights reserved.

  Redistribution and use in source and binary forms, with or without
  modification, are permitted provided that the following conditions
  are met:

  1. Redistributions of source code must retain the above copyright
  notice, this list of conditions and the following disclaimer.
  2. Redistributions in binary form must reproduce the above copyright
  notice, this list of conditions and the following disclaimer in the
  documentation and/or other materials provided with the distribution.
  3. Neither the name of the copyright holder nor the names of its
  contributors may be used to endorse or promote products derived
  from this software without specific prior written permission.

  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
  FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
  COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
  INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
  BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
  POSSIBILITY OF SUCH DAMAGE.

  The above license is used as a license under copyright only.  Please
  reference the OMA IPR Policy for patent licensing terms:
  http://www.openmobilealliance.org/ipr.html
-->
<xs:schema xmlns="urn:oma:xml:xdm:xdm-prefs" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:cp="urn:ietf:params:xml:ns:common-policy" xmlns:ocp="urn:oma:xml:xdm:common-policy" targetNamespace="urn:oma:xml:xdm:xdm-prefs" elementFormDefault="qualified" attributeFormDefault="unqualified">
	<!-- This import brings in the XML language attribute xml:lang -->
	<xs:import namespace="http://www.w3.org/XML/1998/namespace" schemaLocation="http://www.w3.org/2001/xml.xsd"/>
	<xs:import namespace="urn:ietf:params:xml:ns:common-policy" schemaLocation="http://www.iana.org/assignments/xml-registry/schema/common-policy.xsd"/>
	<!-- The root "preferences" element -->
	<xs:element name="preferences">
		<xs:complexType>
			<xs:sequence minOccurs="0" maxOccurs="1">
				<xs:choice>
					<xs:element name="history-prefs" type="historyPrefsType"/>
					<xs:element name="forward-prefs" type="forwardPrefsType"/>
					<xs:any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
				</xs:choice>
			</xs:sequence>
			<xs:anyAttribute processContents="lax"/>
		</xs:complexType>
	</xs:element>
	<xs:complexType name="historyPrefsType">
		<xs:sequence>
			<xs:element name="history-info" type="historyInfoType"/>
			<xs:element name="filter" type="filterType" minOccurs="0" maxOccurs="unbounded"/>
		</xs:sequence>
	</xs:complexType>
	<!-- History Preferences -->
	<xs:complexType name="historyInfoType">
		<xs:sequence>
			<xs:element name="except" type="exceptType"/>
		</xs:sequence>
		<xs:attribute name="state" use="required" type="stateType"/>
	</xs:complexType>
	
	<xs:complexType name="filterType">
		<xs:sequence>
			<xs:element name="conditions" type="cp:conditionsType"/>
			<xs:element name="actions" type="histActionsType"/>
		</xs:sequence>
		<xs:attribute name="state" use="required" type="stateType"/>
		<xs:attribute name="id" use="required" type="xs:string"/>
	</xs:complexType>
	<!-- Conditions for Recording History Information -->
	<xs:element name="operation-type" type="operationsType"/>
	<xs:element name="operation-result" type="operationsResultType"/>
	<xs:element name="document" type="documentType"/>

	
	<!-- Actions to be taken by the XDMS for storing what History Information-->
	<xs:complexType name="histActionsType">
		<xs:sequence>
			<xs:element name="store-changelog" type="xs:boolean"/>
			<xs:element name="store-request-log" type="xs:boolean"/>
		</xs:sequence>
	</xs:complexType>
	<!-- History State -->
	<xs:simpleType name="stateType">
		<xs:restriction base="xs:token">
			<xs:enumeration value="on"/>
			<xs:enumeration value="off"/>
		</xs:restriction>
	</xs:simpleType>
	<xs:complexType name="documentType">
		<xs:attribute name="path" type="xs:anyURI"/>
	</xs:complexType>
	<xs:complexType name="exceptType">
		<xs:sequence>
			<xs:element name="document" type="documentType"/>
		</xs:sequence>
	</xs:complexType>
		<!-- List of Operations which can be included as conditions -->
	<xs:complexType name="operationsType">
		<xs:sequence minOccurs="0" maxOccurs="1">
		<xs:choice>
			<xs:element name="modify" type="emptyType"/>
			<xs:element name="retrieve" type="emptyType"/>
		</xs:choice>
		</xs:sequence>
	</xs:complexType>
		<!-- List of Operations results which can be included as conditions -->
	<xs:complexType name="operationsResultType">
		<xs:sequence minOccurs="0" maxOccurs="1">
		<xs:choice>
			<xs:element name="authorized" type="emptyType"/>
			<xs:element name="un-authorized" type="emptyType"/>
		</xs:choice>
		</xs:sequence>
	</xs:complexType>

	<!-- Forward Preferences -->
	<xs:complexType name="forwardPrefsType">
		<xs:sequence>
			<xs:element name="rule" type="cp:ruleType" minOccurs="0" maxOccurs="unbounded"/>
		</xs:sequence>
	</xs:complexType>
	
	<xs:complexType name="emptyType"/>
	
	<!-- Conditions for handling the incoming Forward request -->
	<xs:element name="content-type" type="xs:string"/>
	<xs:element name="max-size" type="xs:integer"/>


	<!-- Actions for XDMS on how to handle the received Forward request -->
	<xs:element name="accept" type="emptyType"/>
	<xs:element name="reject" type="emptyType"/>
	<xs:element name="confirm" type="emptyType"/>

</xs:schema>
