<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
           xmlns:stsid="tag:atsc.org,2016:XMLSchemas/ATSC3/Delivery/S-TSID/1.0/"
           xmlns:fdt="urn:ietf:params:xml:ns:fdt"
           targetNamespace="tag:atsc.org,2016:XMLSchemas/ATSC3/Delivery/S-TSID/1.0/"
           elementFormDefault="qualified">
	<xs:import namespace="http://www.w3.org/XML/1998/namespace"
	           schemaLocation="W3C/xml.xsd"/>
	<xs:import namespace="urn:ietf:params:xml:ns:fdt"
	           schemaLocation="IETF/RFC6726-FDTInstance.xsd"/>
	<!-- 
			S-TSID
 -->
	<xs:element name="S-TSID"
	            type="stsid:STSIDType"/>
	<xs:element name="RepairFlow"
	            type="stsid:rprFlowType"/>
	<xs:element name="SrcFlow"
	            type="stsid:srcFlowType"/>
	<xs:complexType name="STSIDType">
		<xs:sequence>
			<xs:element name="RS"
			            type="stsid:rSessionType"
			            maxOccurs="unbounded"/>
			<xs:any namespace="##other"
			        processContents="strict"
			        minOccurs="0"
			        maxOccurs="unbounded"/>
		</xs:sequence>
		<xs:anyAttribute processContents="strict"/>
	</xs:complexType>
	<xs:complexType name="rSessionType">
		<xs:sequence>
			<xs:element name="LS"
			            type="stsid:lSessionType"
			            maxOccurs="unbounded"/>
			<xs:any namespace="##other"
			        processContents="strict"
			        minOccurs="0"
			        maxOccurs="unbounded"/>
		</xs:sequence>
		<xs:attribute name="sIpAddr"
		              type="stsid:IPv4addressType"/>
		<xs:attribute name="dIpAddr"
		              type="stsid:IPv4addressType"/>
		<xs:attribute name="dPort"
		              type="stsid:PortType"/>
		<xs:anyAttribute processContents="strict"/>
	</xs:complexType>
	<xs:complexType name="lSessionType">
		<xs:sequence>
			<xs:element ref="stsid:SrcFlow"
			            minOccurs="0"/>
			<xs:element ref="stsid:RepairFlow"
			            minOccurs="0"/>
			<xs:any namespace="##other"
			        processContents="strict"
			        minOccurs="0"
			        maxOccurs="unbounded"/>
		</xs:sequence>
		<xs:attribute name="tsi"
		              type="xs:unsignedInt"
		              use="required"/>
		<xs:attribute name="bw"
		              type="xs:unsignedInt"/>
		<xs:attribute name="startTime"
		              type="xs:dateTime"/>
		<xs:attribute name="endTime"
		              type="xs:dateTime"/>
		<xs:anyAttribute processContents="strict"/>
	</xs:complexType>
	<xs:simpleType name="IPv4addressType">
		<xs:restriction base="xs:token">
			<xs:pattern value="(([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])"/>
		</xs:restriction>
	</xs:simpleType>
	<xs:simpleType name="PortType">
		<xs:restriction base="xs:unsignedShort">
			<xs:minInclusive value="1"/>
		</xs:restriction>
	</xs:simpleType>
	<!-- 
			SrcFlow
 -->
	<xs:complexType name="srcFlowType">
		<xs:sequence>
			<xs:element name="EFDT"
			            type="stsid:EFDTType"
			            minOccurs="0"/>
			<xs:element name="ContentInfo"
			            type="stsid:ContentInfoType"
			            minOccurs="0"/>
			<xs:element name="Payload"
			            type="stsid:PayloadType"
						minOccurs="0" 
			            maxOccurs="unbounded"/>
			<xs:any namespace="##other"
			        processContents="strict"
			        minOccurs="0"
			        maxOccurs="unbounded"/>
		</xs:sequence>
		<xs:attribute name="rt"
		              type="xs:boolean"
		              default="false"/>
		<xs:attribute name="minBuffSize"
		              type="xs:unsignedInt"/>
		<xs:anyAttribute processContents="strict"/>
	</xs:complexType>
	<!--  EFDT Type  -->
	<xs:complexType name="EFDTType">
		<xs:sequence>
			<xs:element name="FDT-Instance"
			            type="fdt:FDT-InstanceType"
			            minOccurs="0"/>
			<xs:any namespace="##other"
			        processContents="strict"
			        minOccurs="0"
			        maxOccurs="unbounded"/>
		</xs:sequence>
		<xs:anyAttribute namespace="##other"
		                 processContents="strict"/>
	</xs:complexType>
	<!--  ContentInfo Type  -->
	<xs:complexType name="ContentInfoType">
		<xs:choice>
			<xs:element name="MediaInfo"
			            type="stsid:MediaInfoType"/>
			<xs:element name="AEAMedia"
			            type="stsid:AEAMediaType"/>
			<xs:any namespace="##other"
			        processContents="strict"
			        minOccurs="0"
			        maxOccurs="unbounded"/>
		</xs:choice>
		<xs:anyAttribute namespace="##other"
		                 processContents="strict"/>
	</xs:complexType>
	<!--  MediaInfo Type  -->
	<xs:complexType name="MediaInfoType">
		<xs:sequence>
			<xs:element name="ContentRating"
			            type="stsid:ContentRatingType"
			            minOccurs="0"
			            maxOccurs="unbounded"/>
			<xs:any namespace="##other"
			        processContents="strict"
			        minOccurs="0"
			        maxOccurs="unbounded"/>
		</xs:sequence>
		<xs:attribute name="startup"
		              type="xs:boolean"
		              default="false"/>
		<xs:attribute ref="xml:lang"/>
		<xs:attribute name="contentType"
		              type="stsid:contentTypeType"/>
		<xs:attribute name="repId"
		              type="stsid:StringNoWhitespaceType"
		              use="required"/>
		<xs:anyAttribute namespace="##other"
		                 processContents="strict"/>
	</xs:complexType>
	<!--  ContentRating Type  -->
	<xs:complexType name="ContentRatingType">
		<xs:sequence>
			<xs:any namespace="##other"
			        processContents="strict"
			        minOccurs="0"
			        maxOccurs="unbounded"/>
		</xs:sequence>
		<xs:attribute name="schemeIdUri"
		              type="xs:anyURI"
		              default="tag:atsc.org,2016:carating:1"/>
		<xs:attribute name="value"
		              type="stsid:valueType"
		              use="required"/>
		<xs:anyAttribute namespace="##other"
		                 processContents="strict"/>
	</xs:complexType>
	<!--  AEA Media Content  -->
	<xs:complexType name="AEAMediaType">
		<xs:sequence>
			<xs:element name="AEAId"
			            type="xs:string"
			            minOccurs="0"
			            maxOccurs="unbounded"/>
			<xs:any namespace="##other"
			        processContents="strict"
			        minOccurs="0"
			        maxOccurs="unbounded"/>
		</xs:sequence>
		<xs:anyAttribute namespace="##other"
		                 processContents="strict"/>
	</xs:complexType>
	<!--  String without white spaces  -->
	<xs:simpleType name="StringNoWhitespaceType">
		<xs:restriction base="xs:string">
			<xs:pattern value="[^\r\n\t \p{Z}]*"/>
		</xs:restriction>
	</xs:simpleType>
	<!--  Content Type enumeration  -->
	<xs:simpleType name="contentTypeType">
		<xs:restriction base="xs:string">
			<xs:enumeration value="audio"/>
			<xs:enumeration value="video"/>
			<xs:enumeration value="subtitles"/>
		</xs:restriction>
	</xs:simpleType>
	<xs:complexType name="PayloadType">
		<xs:attribute name="codePoint"
		              type="stsid:codePointType"
		              default="128"/>
		<xs:attribute name="formatId"
		              type="stsid:formatIdType"
		              use="required"/>
		<xs:attribute name="frag"
		              type="stsid:fragType"
		              default="0"/>
		<xs:attribute name="order"
		              type="xs:boolean"
		              default="true"/>
		<xs:attribute name="srcFecPayloadId"
		              type="stsid:srcFecPayloadIdType"
		              default="0"/>
		<xs:attribute name="fecParams"
		              type="stsid:fecOTIType"/>
		<xs:anyAttribute processContents="strict"/>
	</xs:complexType>
	<xs:simpleType name="formatIdType">
		<xs:restriction base="xs:unsignedByte">
			<xs:minInclusive value="1"/>
			<xs:maxInclusive value="4"/>
		</xs:restriction>
	</xs:simpleType>
	<xs:simpleType name="fragType">
		<xs:restriction base="xs:unsignedByte">
			<xs:maxInclusive value="2"/>
		</xs:restriction>
	</xs:simpleType>
	<xs:simpleType name="srcFecPayloadIdType">
		<xs:restriction base="xs:unsignedByte">
			<xs:maxInclusive value="0"/>
		</xs:restriction>
	</xs:simpleType>
	<!-- 
			RepairFlow
 -->
	<xs:complexType name="rprFlowType">
		<xs:sequence>
			<xs:element name="FECParameters"
			            type="stsid:fecParametersType"
			            minOccurs="0"/>
			<xs:any namespace="##other"
			        processContents="strict"
			        minOccurs="0"
			        maxOccurs="unbounded"/>
		</xs:sequence>
		<xs:anyAttribute processContents="strict"/>
	</xs:complexType>
	<xs:complexType name="fecParametersType">
		<xs:sequence>
			<xs:element name="ProtectedObject"
			            type="stsid:protectedObjectType"
			            minOccurs="0"
			            maxOccurs="unbounded"/>
			<xs:any namespace="##other"
			        processContents="strict"
			        minOccurs="0"
			        maxOccurs="unbounded"/>
		</xs:sequence>
		<xs:attribute name="maximumDelay"
		              type="xs:unsignedInt"
		              default="0"/>
		<xs:attribute name="overhead"
		              type="stsid:percentageType"/>
		<xs:attribute name="minBuffSize"
		              type="xs:unsignedInt"/>
		<xs:attribute name="fecOTI"
		              type="stsid:fecOTIType"
		              use="required"/>
		<xs:attribute name="percentRepair"
		              type="xs:unsignedShort"/>
		<xs:attribute name="checksumList"
		              type="stsid:listOfStringType"/>
		<xs:anyAttribute processContents="strict"/>
	</xs:complexType>
	<xs:simpleType name="percentageType">
		<xs:restriction base="xs:unsignedShort">
			<xs:maxInclusive value="1000"/>
		</xs:restriction>
	</xs:simpleType>
	<xs:complexType name="protectedObjectType">
		<xs:sequence>
			<xs:element name="SourceTOI"
			            type="stsid:SourceTOIType"
			            maxOccurs="unbounded"/>
			<xs:any namespace="##other"
			        processContents="strict"
			        minOccurs="0"
			        maxOccurs="unbounded"/>
		</xs:sequence>
		<xs:attribute name="sessionDescription"
		              type="stsid:sessionDescriptionType"/>
		<xs:attribute name="tsi"
		              type="xs:unsignedInt"
		              use="required"/>
		<xs:anyAttribute processContents="strict"/>
	</xs:complexType>
	<xs:simpleType name="fecOTIType">
		<xs:restriction base="xs:hexBinary">
			<xs:length value="12"/>
		</xs:restriction>
	</xs:simpleType>
	<xs:simpleType name="listOfStringType">
		<xs:list itemType="xs:string"/>
	</xs:simpleType>
	<xs:simpleType name="codePointType">
		<xs:restriction base="xs:unsignedByte">
			<xs:minInclusive value="128"/>
		</xs:restriction>
	</xs:simpleType>
	<xs:simpleType name="valueType">
		<xs:restriction base="xs:string">
			<xs:pattern value="([1-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9][0-9]|25[0-5]),'[ -$#x26;\(-~]*',(\{(0|([1-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9][0-9]|25[0-5])) '[!-$#x26;\(-~]*'\})*"/>
		</xs:restriction>
	</xs:simpleType>
	<xs:complexType name="SourceTOIType">
		<xs:sequence>
			<xs:any namespace="##other"
			        processContents="strict"
			        minOccurs="0"
			        maxOccurs="unbounded"/>
		</xs:sequence>
		<xs:attribute name="x"
		              type="xs:unsignedShort"
		              default="1"/>
		<xs:attribute name="y"
		              type="xs:unsignedShort"
		              default="0"/>
		<xs:anyAttribute processContents="strict"/>
	</xs:complexType>
	<xs:simpleType name="sessionDescriptionType">
		<xs:restriction base="xs:string"> </xs:restriction>
	</xs:simpleType>
</xs:schema>