<xs:schema xmlns:xs='http://www.w3.org/2001/XMLSchema'>
	<xs:annotation>
		<xs:documentation>
			Schema for OppiaMobile course XML files
			Digital Campus
			Version: 4
			Date: 21 Mar 2014
		</xs:documentation>
	</xs:annotation>
	
	<xs:element name="module">
		<xs:complexType>
			<xs:sequence>
				<xs:element name="meta" minOccurs="1" maxOccurs="1"
					type="MetaType" />
				<xs:element name="structure" minOccurs="1" maxOccurs="1"
					type="StructureType" />
				<xs:element name="media" minOccurs="0" maxOccurs="1"
					type="MediaType" />
			</xs:sequence>
		</xs:complexType>
	</xs:element>

	<xs:complexType name="MetaType">
		<xs:sequence>
			<xs:element name="versionid" minOccurs="1" maxOccurs="1"
				type="xs:positiveInteger" />
			<xs:element name="priority" minOccurs="0" maxOccurs="1"
				type="xs:integer" />
			<xs:element name="server" minOccurs="0" maxOccurs="1"
				type="xs:string" />
			<xs:element name="title" minOccurs="1" maxOccurs="unbounded"
				type="LangType" />
			<xs:element name="shortname" minOccurs="1" maxOccurs="1" />
			<xs:element name="description" minOccurs="0" maxOccurs="unbounded"
				type="LangType" />
			<xs:choice minOccurs="0" maxOccurs="unbounded">
				<xs:element name="page" type="PageType" />
				<xs:element name="activity" type="ActivityType" />
			</xs:choice>
			<xs:element name="image" minOccurs="0" maxOccurs="unbounded" />
			<xs:element name="langs" minOccurs="1" maxOccurs="1">
				<xs:complexType>
					<xs:sequence>
						<xs:element name="lang" minOccurs="1" maxOccurs="unbounded"
							type="xs:string" />
					</xs:sequence>
				</xs:complexType>
			</xs:element>

		</xs:sequence>
	</xs:complexType>

	<xs:complexType name="LangType">
		<xs:simpleContent>
			<xs:extension base="xs:string">
				<xs:attribute name="lang" type="xs:string">
				</xs:attribute>
			</xs:extension>
		</xs:simpleContent>
	</xs:complexType>

	<xs:complexType name="PageType">
		<xs:sequence>
			<xs:element name="title" minOccurs="1" maxOccurs="unbounded"
				type="LangType" />
			<xs:element name="image" minOccurs="0" maxOccurs="1">
				<xs:complexType>
					<xs:attribute name="filename" type="xs:string" />
				</xs:complexType>
			</xs:element>
			<xs:element name="location" minOccurs="1" maxOccurs="unbounded"
				type="LangType" />
		</xs:sequence>
		<xs:attribute name="id" type="xs:positiveInteger" />
	</xs:complexType>

	<xs:complexType name="StructureType">
		<xs:sequence>
			<xs:element name="section" minOccurs="1" maxOccurs="unbounded">
				<xs:complexType>
					<xs:sequence>
						<xs:element name="title" minOccurs="1" maxOccurs="unbounded"
							type="LangType" />
						<xs:element name="activities" minOccurs="1" maxOccurs="1">
							<xs:complexType>
								<xs:sequence>
									<xs:element name="activity" minOccurs="1" maxOccurs="unbounded"
										type="ActivityType" />
								</xs:sequence>
							</xs:complexType>
						</xs:element>
					</xs:sequence>
					<xs:attribute name="order" type="xs:positiveInteger"
						use="required" />
				</xs:complexType>
			</xs:element>
		</xs:sequence>
	</xs:complexType>

	<xs:complexType name="ActivityType">
		<xs:sequence>
			<xs:element name="title" minOccurs="1" maxOccurs="unbounded"
				type="LangType" />

			<xs:choice minOccurs="1" maxOccurs="unbounded">
				<xs:element name="media" minOccurs="0" maxOccurs="unbounded"
					type="MediaType" />
				<xs:element name="content" minOccurs="0" maxOccurs="unbounded"
					type="LangType" />
				<xs:element name="description" minOccurs="0" maxOccurs="unbounded"
					type="LangType" />
				<xs:element name="related" minOccurs="0" maxOccurs="1" />
				<xs:element name="location" minOccurs="0" maxOccurs="unbounded">
					<xs:complexType>
						<xs:simpleContent>
							<xs:extension base="xs:string">
								<xs:attribute name="lang" type="xs:string" />
								<xs:attribute name="type" type="xs:string" />
							</xs:extension>
						</xs:simpleContent>
					</xs:complexType>
				</xs:element>
				<xs:element name="image" minOccurs="0" maxOccurs="unbounded">
					<xs:complexType>
						<xs:attribute name="filename" type="xs:string" />
					</xs:complexType>
				</xs:element>
			</xs:choice>
		</xs:sequence>
		<xs:attribute name="type" type="xs:string" />
		<xs:attribute name="order" type="xs:positiveInteger" />
		<xs:attribute name="digest" type="xs:string" />
	</xs:complexType>

	<xs:complexType name="MediaType">
		<xs:sequence>
			<xs:element name="file" minOccurs="1" maxOccurs="unbounded">
				<xs:complexType>
					<xs:attribute name="filename" type="xs:string" use="required" />
					<xs:attribute name="download_url" type="xs:string"
						use="required" />
					<xs:attribute name="digest" type="xs:string" use="required" />
					<xs:attribute name="filesize" type="xs:positiveInteger"
						use="optional" />
					<xs:attribute name="length" type="xs:positiveInteger"
						use="optional" />
				</xs:complexType>
			</xs:element>
		</xs:sequence>
	</xs:complexType>
</xs:schema>
