Schema for DIDL XML Document Type


<!--
Schema for DIDL XML Document Type
From:  http://www.cselt.it/mpeg/public/mpeg-21_did_wd.zip
Document: ISO/IEC JTC 1/SC 29/WG 11 N3971 (section 6)
Status: unofficial, see the canonical version in the URL above
-->
<?xml version="1.0"?>
<!--============================================================-->
<!--============================================================-->
<!--                                                            -->
<!--           Schema for DIDL XML Document Type                -->
<!--                                                            -->
<!--============================================================-->
<!--============================================================-->
<xsd:schema xmlns:xsd="http://www.w3.org/2000/10/XMLSchema"
version="0.01">
	<!--============================================================
			 
	 Basic Principles that apply to all element types:			
	 1) Any element with an attribute named 'ID' of type ID may 
	 	 have a REFERENCE child.
	 2) Any element with an attribute of type ID may have DESCRIPTOR	
	 	 children, and where they are allowed, they are always 	
	 	 the first children.
	 3) Elements with an attribute of type ID *may not* have any
		 attributes which are required.  This is because
		 attributes should be inheritable from a REFERENCE
		 if they are not specified, which is not possible
		 if they are required. 
	 4) If an element has a REFERENCE child 
		 then only DESCRIPTOR (and possibly CONDITION) elements may 
		 precede it, and no elements may follow it.						
	============================================================-->
	<xsd:attributeGroup name="ID_ATTRS">
		<xsd:attribute name="ID" type="xsd:ID" use="optional"/>
	</xsd:attributeGroup>
	<!--============================================================
	 DIDL element may contain one of the top level            
	 (EXTERNAL_REFable) elements: CONTAINER or ITEM.
	============================================================-->
	<xsd:element name="DIDL">
		<xsd:complexType>
			<xsd:sequence>
				<xsd:element ref="DECLARATIONS" minOccurs="0"/>
				<xsd:choice>
					<xsd:element ref="CONTAINER"/>
					<xsd:element ref="ITEM"/>
				</xsd:choice>
			</xsd:sequence>
		</xsd:complexType>
	</xsd:element>
	<!--============================================================
	 A DECLARATIONS element contains any number of ITEMs, DESCRIPTORs,
	 COMPONENTs, and RESOURCEs, in any order.
	
	============================================================-->
	<xsd:element name="DECLARATIONS">
		<xsd:complexType>
			<xsd:choice maxOccurs="unbounded">
				<xsd:element ref="ITEM"/>
				<xsd:element ref="DESCRIPTOR"/>
				<xsd:element ref="COMPONENT"/>
				<xsd:element ref="RESOURCE"/>
				<xsd:element ref="ANNOTATION"/>
			</xsd:choice>
		</xsd:complexType>
	</xsd:element>
	<!--============================================================
	 CONTAINER element may contain any number of CONTAINER elements
	 followed by any number of ITEMS.
	============================================================-->
	<xsd:element name="CONTAINER">
  	<xsd:complexType>
    	<xsd:sequence>
      	<xsd:element ref="DESCRIPTOR" minOccurs="0"
maxOccurs="unbounded"/>
      	<xsd:choice>
        	<xsd:element ref="REFERENCE"/>
			<xsd:sequence>
          	<xsd:element ref="CONTAINER" minOccurs="0"
maxOccurs="unbounded"/>
          	<xsd:element ref="ITEM" minOccurs="0" maxOccurs="unbounded"/>
         	</xsd:sequence>
      	</xsd:choice>
    	</xsd:sequence>
    	<xsd:attributeGroup ref="ID_ATTRS"/>
  	</xsd:complexType>
 	</xsd:element>
	<!--============================================================
	 ITEM element contains any number CHOICE elements,
 	 followed by at least one ITEM or COMPONENT element.
	 An ITEM can be conditional.
	============================================================-->
	<xsd:element name="ITEM">
		<xsd:complexType>
			<xsd:sequence>
				<xsd:element ref="CONDITION" minOccurs="0" maxOccurs="unbounded"/>
				<xsd:element ref="DESCRIPTOR" minOccurs="0" maxOccurs="unbounded"/>
				<xsd:choice>
					<xsd:element ref="REFERENCE"/>
					<xsd:choice minOccurs=^‘0^‘ maxOccurs="unbounded">
						<xsd:element ref="CHOICE"/>
						<xsd:element ref="ITEM"/>
						<xsd:element ref="COMPONENT"/>
					</xsd:choice>
				</xsd:choice>
				<xsd:element ref="ANNOTATION" minOccurs="0" maxOccurs="unbounded"/>
			</xsd:sequence>
			<xsd:attributeGroup ref="ID_ATTRS"/>
		</xsd:complexType>
	</xsd:element>
	<!--============================================================
	 A DESCRIPTOR contains descriptive data about its parent
	 element.
    The DESCRIPTOR can be resource-based (comprised of a single 
    COMPONENT), or text-based (comprised of a single STATEMENT).
	 A DESCRIPTOR can be conditional.
	
	============================================================-->
	<xsd:element name="DESCRIPTOR">
		<xsd:complexType>
			<xsd:sequence>
				<xsd:element ref="CONDITION" minOccurs="0" maxOccurs="unbounded"/>
				<xsd:element ref="DESCRIPTOR" minOccurs="0" maxOccurs="unbounded"/>
				<xsd:choice>
					<xsd:element ref="REFERENCE"/>
					<xsd:element ref="COMPONENT"/>
					<xsd:element ref="STATEMENT"/>
				</xsd:choice>
			</xsd:sequence>
			<xsd:attributeGroup ref="ID_ATTRS"/>
		</xsd:complexType>
	</xsd:element>
	<!--============================================================
	 A STATEMENT contains textual descriptive data within a 
	 DESCRIPTOR. 
	 Attribs: 
	 TYPE		- A string identifying the type of metadata
	============================================================-->
	<xsd:element name="STATEMENT">
		<xsd:complexType mixed="true">
			<xsd:sequence>
				<xsd:any namespace="##any" processContents="skip" minOccurs="0"/>
			</xsd:sequence>
			<xsd:attribute name="TYPE" type="xsd:uriReference"/>
		</xsd:complexType>
	</xsd:element>
	<!--============================================================
	 COMPONENT element contains a RESOURCE element, followed by any 
	 number of ANCHOR elements.
	 A COMPONENT can be conditional.
	============================================================-->
	<xsd:element name="COMPONENT">
		<xsd:complexType>
			<xsd:sequence>
				<xsd:element ref="CONDITION" minOccurs="0" maxOccurs="unbounded"/>
				<xsd:element ref="DESCRIPTOR" minOccurs="0" maxOccurs="unbounded"/>
				<xsd:choice>
					<xsd:element ref="REFERENCE"/>
					<xsd:element ref="RESOURCE" minOccurs="1" maxOccurs="unbounded"/>
				</xsd:choice>
				<xsd:element ref="ANCHOR" minOccurs="0" maxOccurs="unbounded"/>
			</xsd:sequence>
			<xsd:attributeGroup ref="ID_ATTRS"/>
		</xsd:complexType>
	</xsd:element>
	<!--============================================================
	 An ANCHOR element indicates a point of interest in the
	 resource of the parent COMPONENT.
	 An ANCHOR can be conditional.
	
	 Attribs:
	 PRECEDENCE  - An unsigned integer value indicating the position
				   that this start point should occupy relative to the 
				   other start points in this title.  The highest
				   precedence start file is the default entry 
				   point.
	 FRAGMENT    - The fragment identifier that locates the start
				   point position within the parent file. This
				   string, when appended to the SRC attribute
				   of the parent, plus a '#', becomes the full
				   URI for the start point.
	============================================================-->
	<xsd:element name="ANCHOR">
		<xsd:complexType>
			<xsd:sequence>
				<xsd:element ref="CONDITION" minOccurs="0" maxOccurs="unbounded"/>
				<xsd:element ref="DESCRIPTOR" minOccurs="0" maxOccurs="unbounded"/>
			</xsd:sequence>
			<xsd:attribute name="PRECEDENCE"
								type="xsd:unsignedInt" use="default" value="0"/>
			<xsd:attribute name="FRAGMENT" type="xsd:uriReference"/>
			<xsd:attribute name=^‘NAME^‘ type=^‘xsd:ID^‘/>
		</xsd:complexType>
	</xsd:element>
	<!--============================================================
	 CONDITION element contains no children.  It indicates a
	 selection condition for the parent file.  Multiple CONDITION
	 tags indicate an 'OR' relationship, in that only one CONDITION
	 needs to be satisfied for the parent element to be retrieved,
	 included, etc.  The individual IDs in the SELECT attribute of
	 a CONDITION tag have an 'AND' relationship in that selection
	 of all of the IDs referenced are required to satisfy that
	 CONDITION.
	 Attribs:
	 REQUIRE   - Indicates the SELECTION(s) that must be affirmed 
               for this	CONDITION to be "satisfied".
	 EXCEPT    - Indicates the SELECTION(s) that must be denied 
				 	 for this CONDITION to be "satisfied".
	============================================================-->
	<xsd:element name="CONDITION">
		<xsd:complexType>
			<xsd:attribute name="REQUIRE" type="xsd:IDREFS"/>
			<xsd:attribute name="EXCEPT" type="xsd:IDREFS"/>
		</xsd:complexType>
	</xsd:element>
	<!--============================================================
	 CHOICE element contains one or more SELECTIONs.  
	 A CHOICE can be conditional.
	 
	 Attribs:
	 MIN_SELECTIONS	-	Minimum number of SELECTIONs that must be made. If
not present,
  there is no minimum.
	 MAX_SELECTIONS	-	Maximum number of SELECTIONs that can be made.  If
not present, 
there is no maximum.
				
	 DEFAULT		- Indicates one or more	default selections to use in the
absence 
of info	to make a more specific decision.  Must conform to the 
requirements of the MIN_SELECTIONS and/or MAX_SELECTIONS
attributes if present.
	 CHOICE_ID	- Serves as a TARGET for ASSERTION elements.
	  
	============================================================-->
	<xsd:element name="CHOICE">
		<xsd:complexType>
			<xsd:sequence>
				<xsd:element ref="CONDITION" minOccurs="0" maxOccurs="unbounded"/>
				<xsd:element ref="DESCRIPTOR" minOccurs="0" maxOccurs="unbounded"/>
				<xsd:element ref="SELECTION" maxOccurs="unbounded"/>
				<xsd:element ref=^‘OVERRIDE^‘ minOccurs=^‘0^‘ maxOccurs = ^”unbounded^‘/>
			</xsd:sequence>
			<xsd:attribute name="MIN_SELECTIONS" type="xsd:nonNegativeInteger"/>
			<xsd:attribute name="MAX_SELECTIONS" type="xsd:nonNegativeInteger"/>
			<xsd:attribute name="DEFAULT" type="xsd:IDREFS"/>
			<xsd:attribute name="CHOICE_ID" type="xsd:ID"/>
		</xsd:complexType>
	</xsd:element>
	<!--============================================================
	 SELECTION element contains no children.
	 A SELECTION can be conditional.
	
	 Attrib: SELECT_ID - Uniquely identifies the SELECTION
	
	============================================================-->
	<xsd:element name="SELECTION">
		<xsd:complexType>
			<xsd:sequence>
				<xsd:element ref="CONDITION" minOccurs="0" maxOccurs="unbounded"/>
				<xsd:element ref="DESCRIPTOR" minOccurs="0" maxOccurs="unbounded"/>
				<xsd:element ref=^‘OVERRIDE^‘ minOccurs=^‘0^‘ maxOccurs =
^”unbounded^‘/>				</xsd:sequence>
			<xsd:attribute name="SELECT_ID" type="xsd:ID" use="required"/>
		</xsd:complexType>
	</xsd:element>
	<!--============================================================
	 OVERRIDE element identifies a CHOICE or SELECTION that is
	 superseded by the OVERRIDE^“s parent.
	 Attribs: 
	 TARGET ^÷ An XPointer identifying the CHOICE or SELECTION being
overridden
	============================================================-->
	<xsd:element name="OVERRIDE">
		<xsd:complexType>
			<xsd:attribute name="TARGET" type="xsd:uriReference"/>
		</xsd:complexType>
	</xsd:element>
	<!--============================================================
	 RESOURCE element contains or points to binary data. The
	 contained data can be binary or any valid XML element.
	 Attribs: 
	 TYPE 	 - An identifier of a recognized scheme indicating the type of
the resource
	 REF	 - A URI from which the resource data can be obtained
	 LOCAL_PATH - Specifies the required location for a cached version
	============================================================-->
	<xsd:element name="RESOURCE">
		<xsd:complexType mixed="true">
			<xsd:attribute name="TYPE" type="xsd:uriReference"/>
			<xsd:attribute name="REF" type="xsd:uriReference"/>
			<xsd:attribute name="LOCAL_PATH" type="xsd:uriReference"/>
		</xsd:complexType>
		<!-- "mixed" content model allows for embedded resources -->
	</xsd:element>
	<!--============================================================
	 
	 REFERENCE contains no child elements				
	 Attrib: URI - Points to the referenced element
	
	============================================================-->
	<xsd:element name="REFERENCE">
		<xsd:complexType>
			<xsd:attribute name="URI" type="xsd:uriReference" use="required"/>
		</xsd:complexType>
	</xsd:element>
	<!--============================================================
	 ANNOTATION contains any number of ASSERTIONs followed by 
	 any number of DESCRIPTORs followed by any number of ANCHORs			
	
	 Attrib: TARGET - Points to the element being annotated
	
	 Restrictions: 
		1. The TARGET must reference an element within the
			parent ITEM, or can reference the parent ITEM itself.
		2. The contents of an ANNOTATION must conform with the 
			content model of the targeted element. For example,
			ANCHORs can be included only if the TARGET references
			a COMPONENT.
	
	============================================================-->
	<xsd:element name="ANNOTATION">
		<xsd:complexType>
			<xsd:choice>
				<xsd:element ref="REFERENCE"/>
				<xsd:sequence>
					<xsd:element ref="ASSERTION" minOccurs="0" maxOccurs="unbounded"/>
					<xsd:element ref="DESCRIPTOR" minOccurs="0" maxOccurs="unbounded"/>
					<xsd:element ref="ANCHOR" minOccurs="0" maxOccurs="unbounded"/>
				</xsd:sequence>
			</xsd:choice>
			<xsd:attribute name="TARGET" type="xsd:IDREF" use="required"/>
			<xsd:attributeGroup ref="ID_ATTRS"/>
		</xsd:complexType>
	</xsd:element>
	<!--============================================================
	 ASSERTION contains no child elements
	
	 Attribs: 
	
		TRUE  - The set of selection IDs which are asserted as true
		FALSE	- The set of selection IDs which are asserted as false
	
	============================================================-->
	<xsd:element name="ASSERTION">
		<xsd:complexType>
			<xsd:attribute name="TARGET" type="xsd:IDREF" use="required"/>
			<xsd:attribute name="TRUE" type="xsd:IDREFS" use="optional"/>
			<xsd:attribute name="FALSE" type="xsd:IDREFS" use="optional"/>
		</xsd:complexType>
	</xsd:element>
</xsd:schema>