<?xml version="1.0" encoding="UTF-8"?>

<!-- 
XDM - Modification History
    version - 1.0.1
    date    - 03 May 2016
    
FILE INFORMATION
    
    OMA Permanent Document
      File: OMA-SUP-XSD_xdm_modification_history-V1_0_1-20160503-A
      Type: Text - Schema Description
    
    Public Reachable Information
      Path: http://www.openmobilealliance.org/tech/profiles
      Name: xdm_modification_history.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
    targetNamespace="urn:oma:xml:xdm:hist-mod"
    xmlns="urn:oma:xml:xdm:hist-mod"   
    xmlns:xs="http://www.w3.org/2001/XMLSchema"
    xmlns:df="urn:ietf:params:xml:ns:xcap-diff"
    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:xcap-diff "
        schemaLocation="http://www.iana.org/assignments/xml-registry/schema/xcap-diff.xsd"/>
    

    <!-- The root "history-information" element -->
    <xs:element name="history-information">
        <xs:complexType>
            <xs:sequence>
                <xs:element name="patch" type="patchType" minOccurs="0" maxOccurs="unbounded"/>
            </xs:sequence>
        </xs:complexType>
    </xs:element>
    
    <!-- The type of "patch" element -->
    <xs:complexType name="patchType">
		<xs:sequence minOccurs="0" maxOccurs="1">
    	<xs:choice>
	        <xs:element name="add" type="df:add"/>
	        <xs:element name="remove">
	            <xs:complexType mixed="true">
	                <xs:complexContent>
	                    <xs:extension base="df:remove">
	                        <xs:attribute name="modified-ref" type="xs:string"/>
	                    </xs:extension>
	                </xs:complexContent>
	            </xs:complexType>
	        </xs:element>
	        <xs:element name="replace">
	            <xs:complexType mixed="true">
	                <xs:complexContent>
	                    <xs:extension base="df:replace">
	                        <xs:attribute name="modified-ref" type="xs:string"/>
	                    </xs:extension>
	                </xs:complexContent>
	            </xs:complexType>
	        </xs:element>
	        <xs:element name="restore" type="restoreType"/>
	        <xs:element name="diff-write" type="df:documentType"/>
        </xs:choice>
        <xs:element name="modified-information" type="modifiedInformationType" minOccurs="0" maxOccurs="1"/>
        </xs:sequence>
        <xs:attribute name="id" type="xs:string"/>
        <xs:attribute name="operation-requester" type="xs:anyURI"/>
        <xs:attribute name="timestamp" type="xs:dateTime"/>
        <xs:attribute name="new-etag" type="xs:string"/>
        <xs:attribute name="previous-etag" type="xs:string"/>
        <xs:attribute name="type">
            <xs:simpleType>
                <xs:restriction base="xs:string">
                    <xs:enumeration value="add"/>
                    <xs:enumeration value="remove"/>
                    <xs:enumeration value="replace"/>
                    <xs:enumeration value="restore"/>
                    <xs:enumeration value="diff-write"/>
                </xs:restriction>
            </xs:simpleType>
        </xs:attribute>
    </xs:complexType>
    
    <!-- The type of "modified-information" element -->
    <xs:complexType name="modifiedInformationType">
        <xs:sequence>
            <xs:element name="change-logs" type="changeLogsType" minOccurs="0" maxOccurs="unbounded"/>
        </xs:sequence>
        <xs:attribute name="id" type="xs:string" use="required"/>
    </xs:complexType>
    
    <!-- The type of "restore" element -->
    <xs:complexType name="restoreType">
        <xs:complexContent mixed="true">
	        <xs:restriction base="xs:anyType">
	           	<xs:sequence>
	              <xs:any processContents="lax" namespace="##any"
	                       minOccurs="0" maxOccurs="1"/>
	             </xs:sequence>
	           <xs:attribute name="sel" type="df:xpath" use="required"/>
	        </xs:restriction>
	    </xs:complexContent>
    </xs:complexType>
        
    <xs:complexType name="changeLogsType">
        <xs:choice>
            <xs:element name="previous-element">
             <xs:complexType>
				<xs:sequence>
                  <xs:any />
				</xs:sequence>
			 </xs:complexType>
            </xs:element>
            <xs:element name="previous-attribute"  type="xs:string"/>
        </xs:choice>
    </xs:complexType>
</xs:schema>
