<?xml version="1.0" encoding="UTF-8"?>
<!-- 
	Mobile Broadcast - Service Guide Delivery Descriptor
		version     - 1.0
		date        - 12 Feb 2009

	FILE INFORMATION

	OMA Permanent Document
	File: OMA-SUP-XSD_bcast_sg_sgdd-V1_0-20090212-A
	Type: Text - Schema Description

	Public Reachable Information
	Path: http://www.openmobilealliance.org/tech/profiles
	Name: bcast_sg_sgdd-v1_0.xsd

	NORMATIVE INFORMATION

	Information about this file can be found in the specification
	OMA-TS-BCAST_ServiceGuide-V1_0
	available at http://www.openmobilealliance.org/

	Send comments to technical-comments@mail.openmobilealliance.org

	LEGAL DISCLAIMER

	Use of this document is subject to all of the terms and conditions
	of the Use Agreement located at
	http://www.openmobilealliance.org/UseAgreement.html

	You may use this document or any part of the document for internal
	or educational purposes only, provided you do not modify, edit or
	take out of context the information in this document in any manner.
	Information contained in this document may be used, at your sole
	risk, for any purposes.

	You may not use this document in any other manner without the prior
	written permission of the Open Mobile Alliance.  The Open Mobile
	Alliance authorizes you to copy this document, provided that you
	retain all copyright and other proprietary notices contained in the
	original materials on any copies of the materials and that you
	comply strictly with these terms.  This copyright permission does
	not constitute an endorsement of the products or services.  The
	Open Mobile Alliance assumes no responsibility for errors or
	omissions in this document.

	Each Open Mobile Alliance member has agreed to use reasonable
	endeavors to inform the Open Mobile Alliance in a timely manner of
	Essential IPR as it becomes aware that the Essential IPR is related
	to the prepared or published specification.  However, the members
	do not have an obligation to conduct IPR searches.  The declared
	Essential IPR is publicly available to members and non-members of
	the Open Mobile Alliance and may be found on the "OMA IPR
	Declarations" list at http://www.openmobilealliance.org/ipr.html.
	The Open Mobile Alliance has not conducted an independent IPR review
	of this document and the information contained herein, and makes no
	representations or warranties regarding third party IPR, including
	without limitation patents, copyrights or trade secret rights.  This
	document may contain inventions for which you must obtain licenses
	from third parties before making, using or selling the inventions.
	Defined terms above are set forth in the schedule to the Open Mobile
	Alliance Application Form.

	NO REPRESENTATIONS OR WARRANTIES (WHETHER EXPRESS OR IMPLIED) ARE
	MADE BY THE OPEN MOBILE ALLIANCE OR ANY OPEN MOBILE ALLIANCE MEMBER
	OR ITS AFFILIATES REGARDING ANY OF THE IPR'S REPRESENTED ON THE "OMA
	IPR DECLARATIONS" LIST, INCLUDING, BUT NOT LIMITED TO THE ACCURACY,
	COMPLETENESS, VALIDITY OR RELEVANCE OF THE INFORMATION OR WHETHER OR
	NOT SUCH RIGHTS ARE ESSENTIAL OR NON-ESSENTIAL.

	THE OPEN MOBILE ALLIANCE IS NOT LIABLE FOR AND HEREBY DISCLAIMS ANY
	DIRECT, INDIRECT, PUNITIVE, SPECIAL, INCIDENTAL, CONSEQUENTIAL, OR
	EXEMPLARY DAMAGES ARISING OUT OF OR IN CONNECTION WITH THE USE OF
	DOCUMENTS AND THE INFORMATION CONTAINED IN THE DOCUMENTS.

	Copyright 2008 Open Mobile Alliance Ltd.  All Rights Reserved.
	Used with the permission of the Open Mobile Alliance Ltd. under the
	terms set forth above.
-->

<xs:schema xmlns="urn:oma:xml:bcast:sg:sgdd:1.0" xmlns:xs="http://www.w3.org/2001/XMLSchema"
	targetNamespace="urn:oma:xml:bcast:sg:sgdd:1.0" elementFormDefault="qualified"
	attributeFormDefault="unqualified">
	<!-- Importing xml default declarations (like xml:lang and xml:space) -->
	<xs:import namespace="http://www.w3.org/XML/1998/namespace"
		schemaLocation="http://www.w3.org/2001/xml.xsd"/>
	<!--
	======================================
	Service Guide Delivery Descriptor 
	=======================================
    	-->
	<xs:element name="ServiceGuideDeliveryDescriptor" type="ServiceGuideDeliveryDescriptorType"/>
	<xs:complexType name="ServiceGuideDeliveryDescriptorType">
		<xs:sequence>
			<xs:element name="NotificationReception" type="NotificationReceptionType" minOccurs="0"/>
			<xs:element name="BSMList" minOccurs="0">
				<xs:complexType>
					<xs:sequence>
						<xs:element name="BSMSelector" type="BSMSelectorType" maxOccurs="unbounded"/>
					</xs:sequence>
				</xs:complexType>
			</xs:element>
			<xs:element name="DescriptorEntry" type="DescriptorEntryType" maxOccurs="unbounded"/>
			<xs:element name="PrivateExt" type="PrivateExtType" minOccurs="0"/>
		</xs:sequence>
		<xs:attribute name="id" type="xs:anyURI" use="optional"/>
		<xs:attribute name="version" type="xs:unsignedInt" use="optional"/>
	</xs:complexType>
	<xs:complexType name="PrivateExtType">
		<xs:sequence>
			<xs:annotation>
				<xs:documentation> This container provides the place for proprietary and
					application-specific extensions. Extensions SHALL use a different namespace.
				</xs:documentation>
			</xs:annotation>
			<xs:any namespace="##other" processContents="skip" minOccurs="0" maxOccurs="unbounded"/>
		</xs:sequence>
	</xs:complexType>
	<!--
	======================================
	NotificationReception sub-type
	=======================================
	-->
	<xs:complexType name="NotificationReceptionType">
		<!-- 
		 this construct implements the constraint: 
		"at least one of the elements <IPBroadcastDelivery> or <PollURL> SHALL be present." 
        -->
		<xs:sequence>
			<xs:choice>
				<xs:sequence>
					<xs:element name="IPBroadcastDelivery">
						<xs:complexType>
							<xs:attribute name="port" type="xs:unsignedInt" use="required"/>
							<xs:attribute name="address" type="xs:string" use="required"/>
						</xs:complexType>
					</xs:element>
					<xs:element name="PollURL" type="xs:anyURI" minOccurs="0" maxOccurs="unbounded"/>
				</xs:sequence>
				<xs:element name="PollURL" type="xs:anyURI" maxOccurs="unbounded"/>
			</xs:choice>
			<xs:element name="PollPeriod" minOccurs="0" type="xs:decimal"/>
		</xs:sequence>
	</xs:complexType>
	<!--
	======================================
	BSMSelector sub-type
	=======================================
    	-->
	<!--
		The type of bsmFilterCode. 
		1 - BSMCode (Smart Card Code) 
		This is used if the determination is made based on the country and operator code in the (U)SIM/(R-)UIM/CSIM
		2 - BSMCode (Non Smart Card Code):
		This is used if the determination is made based on the country and operator code in the terminal
		Other values are reserved.
	-->
	<xs:simpleType name="BFCRangeType">
		<xs:restriction base="xs:unsignedByte">
			<xs:minInclusive value="1"/>
			<xs:maxInclusive value="2"/>
		</xs:restriction>
	</xs:simpleType>
	<xs:simpleType name="Digit2Type">
		<xs:restriction base="xs:string">
			<xs:pattern value="[0-9]{2}"/>
		</xs:restriction>
	</xs:simpleType>
	<xs:simpleType name="Digit3Type">
		<xs:restriction base="xs:string">
			<xs:pattern value="[0-9]{3}"/>
		</xs:restriction>
	</xs:simpleType>
	<xs:simpleType name="Digit4Type">
		<xs:restriction base="xs:string">
			<xs:pattern value="[0-9]{4}"/>
		</xs:restriction>
	</xs:simpleType>
	<xs:simpleType name="Digit8Type">
		<xs:restriction base="xs:string">
			<xs:pattern value="[0-9]{8}"/>
		</xs:restriction>
	</xs:simpleType>
	<xs:simpleType name="Digit23Type">
		<xs:restriction base="xs:string">
			<xs:pattern value="[0-9]{2}[0-9]?"/>
		</xs:restriction>
	</xs:simpleType>
	<xs:complexType name="BSMFilterCodeType">
		<xs:choice minOccurs="0">
			<xs:element name="NetworkCode3GPP">
				<xs:complexType>
					<xs:attribute name="mobileCountryCode" type="Digit3Type" use="optional"/>
					<xs:attribute name="mobileNetworkCode" type="Digit23Type" use="optional"/>
					<xs:attribute name="networkSubsetCode" type="Digit2Type" use="optional"/>
					<xs:attribute name="networkSubsetCodeRangeStart" type="Digit2Type" use="optional"/>
					<xs:attribute name="networkSubsetCodeRangeEnd" type="Digit2Type" use="optional"/>
					<xs:attribute name="codeRangeStart" type="Digit8Type" use="optional"/>
					<xs:attribute name="codeRangeEnd" type="Digit8Type" use="optional"/>
				</xs:complexType>
			</xs:element>
			<xs:element name="NetworkCode3GPP2">
				<xs:complexType>
					<xs:attribute name="mobileCountryCode" type="Digit3Type" use="optional"/>
					<xs:attribute name="mobileNetworkCode" type="Digit23Type" use="optional"/>
					<xs:attribute name="iRMBasedMIN" type="Digit4Type" use="optional"/>
					<xs:attribute name="hRPDRealm" type="xs:integer" use="optional"/>
					<xs:attribute name="ruimCSIMCodeRangeStart" type="xs:string" use="optional"/>
					<xs:attribute name="ruimCSIMCodeRangeEnd" type="xs:string" use="optional"/>
				</xs:complexType>
			</xs:element>
		</xs:choice>
		<xs:attribute name="type" type="BFCRangeType" use="required"/>
		<xs:attribute name="serviceProviderCode" type="xs:unsignedByte" use="optional"/>
		<xs:attribute name="corporateCode" type="xs:unsignedByte" use="optional"/>
		<xs:attribute name="serviceProviderName" type="xs:string" use="optional"/>
		<xs:attribute name="nonSmartCardCode" type="xs:string" use="optional"/>
	</xs:complexType>
	<xs:complexType name="BSMSelectorType">
		<xs:sequence>
			<xs:element name="BSMFilterCode" type="BSMFilterCodeType" minOccurs="0"/>
			<xs:element name="Name" type="LanguageString" maxOccurs="unbounded"/>
			<xs:element name="RoamingRule" type="RoamingRuleType" minOccurs="0" maxOccurs="unbounded"/>
			<xs:element name="NotificationReception" type="NotificationReceptionType" minOccurs="0" />
		</xs:sequence>
		<xs:attribute name="id" type="xs:anyURI" use="required"/>
		<xs:attribute name="roamingRuleRequestAddress" type="xs:anyURI" use="optional"/>
	</xs:complexType>
	<xs:complexType name="LanguageString">
		<xs:simpleContent>
			<xs:extension base="xs:string">
				<xs:attribute ref="xml:lang" use="optional"/>
			</xs:extension>
		</xs:simpleContent>
	</xs:complexType>
	<!-- 
	======================================
	Roaming Rule sub-type 
	======================================
	-->
	<xs:element name="RoamingRule" type="RoamingRuleType"/>
	<xs:complexType name="RoamingRuleType">
		<xs:sequence>
			<xs:element name="TimeFrame" minOccurs="0" maxOccurs="unbounded">
				<xs:complexType>
					<xs:attribute name="startTime" type="xs:unsignedInt" use="optional"/>
					<xs:attribute name="endTime" type="xs:unsignedInt" use="optional"/>
				</xs:complexType>
			</xs:element>
			<xs:element name="AllowPurchaseItem" minOccurs="0">
				<xs:complexType>
					<xs:sequence>
						<xs:element name="Id" type="xs:anyURI" maxOccurs="unbounded"/>
					</xs:sequence>
				</xs:complexType>
			</xs:element>
			<xs:element name="AllowPurchaseData" minOccurs="0">
				<xs:complexType>
					<xs:sequence>
						<xs:element name="Id" type="xs:anyURI" maxOccurs="unbounded"/>
					</xs:sequence>
				</xs:complexType>
			</xs:element>
			<xs:element name="AllowService" minOccurs="0">
				<xs:complexType>
					<xs:sequence>
						<xs:element name="Id" type="xs:anyURI" maxOccurs="unbounded"/>
					</xs:sequence>
				</xs:complexType>
			</xs:element>
			<xs:element name="AllowContent" minOccurs="0">
				<xs:complexType>
					<xs:sequence>
						<xs:element name="Id" type="xs:anyURI" maxOccurs="unbounded"/>
					</xs:sequence>
				</xs:complexType>
			</xs:element>
			<xs:element name="DenyPurchaseItem" minOccurs="0">
				<xs:complexType>
					<xs:sequence>
						<xs:element name="Id" type="xs:anyURI" maxOccurs="unbounded"/>
					</xs:sequence>
				</xs:complexType>
			</xs:element>
			<xs:element name="DenyPurchaseData" minOccurs="0">
				<xs:complexType>
					<xs:sequence>
						<xs:element name="Id" type="xs:anyURI" maxOccurs="unbounded"/>
					</xs:sequence>
				</xs:complexType>
			</xs:element>
			<xs:element name="DenyService" minOccurs="0">
				<xs:complexType>
					<xs:sequence>
						<xs:element name="Id" type="xs:anyURI" maxOccurs="unbounded"/>
					</xs:sequence>
				</xs:complexType>
			</xs:element>
			<xs:element name="DenyContent" minOccurs="0">
				<xs:complexType>
					<xs:sequence>
						<xs:element name="Id" type="xs:anyURI" maxOccurs="unbounded"/>
					</xs:sequence>
				</xs:complexType>
			</xs:element>
		</xs:sequence>
		<xs:attribute name="allowAll" type="xs:boolean" use="optional" default="false"/>
		<xs:attribute name="denyAll" type="xs:boolean" use="optional" default="false"/>
	</xs:complexType>
	<!--
	======================================
	DescriptorEntry sub-type
	=======================================
	-->
	<xs:complexType name="DescriptorEntryType">
		<xs:sequence>
			<xs:element name="GroupingCriteria" type="GroupingCriteriaType" minOccurs="0"/>
			<xs:element name="Transport" type="TransportType" minOccurs="0"/>
			<xs:element name="AlternativeAccessURL" type="xs:anyURI" minOccurs="0"
				maxOccurs="unbounded"/>
			<xs:element name="ServiceGuideDeliveryUnit" type="ServiceGuideDeliveryUnitType"
				maxOccurs="unbounded"/>
		</xs:sequence>
		<xs:attribute name="type" type="DescriptorEntryTypeRangeType" use="optional" default="0"/>
	</xs:complexType>
	<xs:complexType name="GroupingCriteriaType">
		<xs:sequence>
			<xs:element name="TimeGroupingCriteria" type="TimeGroupingCriteriaType" minOccurs="0"/>
			<xs:element name="GenreGroupingCriteria" type="GenreType" minOccurs="0"/>
			<xs:element name="BSMSelector" type="BSMSelectorIDRefType" minOccurs="0"
				maxOccurs="unbounded"/>
			<xs:element name="ServiceCriteria" type="xs:anyURI" minOccurs="0"/>
		</xs:sequence>
	</xs:complexType>
	<xs:complexType name="TimeGroupingCriteriaType">
		<xs:attribute name="startTime" type="xs:unsignedInt" use="required"/>
		<xs:attribute name="endTime" type="xs:unsignedInt" use="required"/>
	</xs:complexType>
	<xs:complexType name="BSMSelectorIDRefType">
		<xs:attribute name="idRef" type="xs:anyURI" use="required"/>
	</xs:complexType>
	<!-- Genre -->
	<xs:simpleType name="GenreTypeType">
		<xs:restriction base="xs:string">
			<xs:enumeration value="main"/>
			<xs:enumeration value="secondary"/>
			<xs:enumeration value="other"/>
		</xs:restriction>
	</xs:simpleType>
	<xs:complexType name="GenreType">
		<xs:simpleContent>
			<xs:extension base="xs:string">
				<xs:attribute name="type" type="GenreTypeType" use="optional"/>
				<xs:attribute name="href" type="xs:anyURI" use="optional"/>
			</xs:extension>
		</xs:simpleContent>
	</xs:complexType>
	<xs:complexType name="TransportType">
		<xs:attribute name="ipAddress" type="xs:string" use="required"/>
		<xs:attribute name="port" type="xs:unsignedShort" use="required"/>
		<xs:attribute name="srcIpAddress" type="xs:string" use="optional"/>
		<xs:attribute name="transmissionSessionID" type="xs:unsignedShort" use="required"/>
		<xs:attribute name="hasFDT" type="xs:boolean" default="true" use="optional"/>
	</xs:complexType>
	<xs:complexType name="ServiceGuideDeliveryUnitType">
		<xs:sequence>
			<xs:element name="Fragment" type="FragmentType" maxOccurs="unbounded"/>
		</xs:sequence>
		<xs:attribute name="transportObjectID" type="xs:positiveInteger" use="optional"/>
		<xs:attribute name="versionIDLength" type="xs:unsignedLong" use="optional"/>
		<xs:attribute name="contentLocation" type="xs:anyURI" use="optional"/>
		<xs:attribute name="validFrom" type="xs:unsignedInt" use="optional"/>
		<xs:attribute name="validTo" type="xs:unsignedInt" use="optional"/>
	</xs:complexType>
	<xs:complexType name="FragmentType">
		<xs:sequence>
			<xs:element name="GroupingCriteria" minOccurs="0">
				<xs:complexType>
					<xs:sequence>
						<xs:element name="TimeGroupingCriteria" type="TimeGroupingCriteriaType"
							minOccurs="0"/>
						<xs:element name="BSMSelector" type="BSMSelectorIDRefType" minOccurs="0"
							maxOccurs="unbounded"/>
					</xs:sequence>
				</xs:complexType>
			</xs:element>
		</xs:sequence>
		<xs:attribute name="transportID" type="xs:unsignedInt" use="optional"/>
		<xs:attribute name="id" type="xs:anyURI" use="required"/>
		<xs:attribute name="version" type="xs:unsignedInt" use="required"/>
		<xs:attribute name="validFrom" type="xs:unsignedInt" use="optional"/>
		<xs:attribute name="validTo" type="xs:unsignedInt" use="optional"/>
		<xs:attribute name="fragmentEncoding" type="FragmentEncodingType" use="required"/>
		<xs:attribute name="fragmentType" type="FragmentTypeType" use="optional"/>
	</xs:complexType>
	<!--
	Encoding of a Service Guide fragment
	0 - XML encoded OMA BCAST Service Guide fragment
	1 - SDP fragment 
	2 - MBMS User Service Description as specified in [26.346] (see 5.1.2.4, SessionDescriptionReference)
	3 - XML encoded Associated Delivery Procedure as specified in [BCAST10-Distribution] section 5.3.4.
	4-127 - reserved for future BCAST extensions
	128-255 - available for proprietary extensions
    	-->
	<xs:simpleType name="FragmentEncodingType">
		<xs:union memberTypes="FragmentEncodingLRType ReservedProprietaryExtByteRangeType"/>
	</xs:simpleType>
	<xs:simpleType name="FragmentEncodingLRType">
		<xs:restriction base="xs:unsignedByte">
			<xs:minInclusive value="0"/>
			<xs:maxInclusive value="3"/>
		</xs:restriction>
	</xs:simpleType>
	<!--
	Type of an XML encoded BCAST Service Guide fragment
	0 - unspecified
	1 - "Service" Fragment
	2 - "Content" fragment
	3 - "Schedule" Fragment
	4 - "Access" Fragment
	5 - "PurchaseItem" Fragment
	6 - "PurchaseData" Fragment
	7 - "PurchaseChannel" Fragment
	8 - "PreviewData" Fragment
	9 - "InteractivityData" Fragment
	10-127 - reserved for BCAST extensions 
	128-255 - available for proprietary extensions
	-->
	<xs:simpleType name="FragmentTypeType">
		<xs:union memberTypes="FragmentTypeLRType ReservedProprietaryExtByteRangeType"/>
	</xs:simpleType>
	<xs:simpleType name="FragmentTypeLRType">
		<xs:restriction base="xs:unsignedByte">
			<xs:minInclusive value="0"/>
			<xs:maxInclusive value="9"/>
		</xs:restriction>
	</xs:simpleType>
	<!--
		Signalling whether set of fragments in DescriptorEntry is consistent
		0 - DescriptorEntry represents a PART of a set of fragments that is consistent  (default)
		1 - SINGLE DescriptorEntry represents a set of fragments that is consistent
		2 - SINGLE DescriptorEntry represents a set of fragments that might not be consistent
		3-255 - reserved for future BCAST extensions
	-->
	<xs:simpleType name="DescriptorEntryTypeRangeType">
		<xs:restriction base="xs:unsignedByte">
			<xs:minInclusive value="0"/>
			<xs:maxInclusive value="2"/>
		</xs:restriction>
	</xs:simpleType>
	<!--
	======================================
	SGResponse for interactive SGDD delivery
	=======================================
	-->
	<xs:element name="SGResponse" type="SGResponseType"/>
	<xs:complexType name="SGResponseType">
		<xs:sequence>
			<xs:element name="SupportedVersion" type="xs:string" minOccurs="0" maxOccurs="unbounded"/>
			<xs:element name="ServiceGuideDeliveryDescriptor"
				type="ServiceGuideDeliveryDescriptorType" minOccurs="0" maxOccurs="unbounded"/>
			<xs:element name="ResponseValidity" minOccurs="0">
				<xs:complexType>
					<xs:attribute name="expirationTime" use="required" type="xs:unsignedInt"/>
					<xs:attribute name="timeWindow" use="optional" type="xs:decimal"/>
				</xs:complexType>
			</xs:element>
			<xs:element name="PrivateExt" type="PrivateExtType" minOccurs="0"/>
		</xs:sequence>
		<xs:attribute name="status" type="SGResponseStatusType" use="required"/>
		<xs:attribute name="lastResponseVersion" type="xs:unsignedInt" use="optional"/>
	</xs:complexType>
	<xs:simpleType name="ReservedProprietaryExtByteRangeType">
		<xs:restriction base="xs:unsignedByte">
			<xs:minInclusive value="128"/>
			<xs:maxInclusive value="255"/>
		</xs:restriction>
	</xs:simpleType>
	<!-- allowed status codes -->
	<xs:simpleType name="SGResponseStatusCodesType">
		<xs:restriction base="xs:unsignedByte">
			<xs:enumeration value="0"/>
			<xs:enumeration value="7"/>
			<xs:enumeration value="8"/>
			<xs:enumeration value="12"/>
			<xs:enumeration value="16"/>
			<xs:enumeration value="17"/>
			<xs:enumeration value="18"/>
			<xs:enumeration value="20"/>
			<xs:enumeration value="21"/>
			<xs:enumeration value="23"/>
			<xs:enumeration value="28"/>
		</xs:restriction>
	</xs:simpleType>
	<xs:simpleType name="SGResponseStatusType">
		<xs:union memberTypes="SGResponseStatusCodesType ReservedProprietaryExtByteRangeType"/>
	</xs:simpleType>
</xs:schema>
