<!-- Copyright 2004 The Apache Software Foundation

     Licensed under the Apache License, Version 2.0 (the "License");
     you may not use this file except in compliance with the License.
     You may obtain a copy of the License at

         http://www.apache.org/licenses/LICENSE-2.0

     Unless required by applicable law or agreed to in writing, software
     distributed under the License is distributed on an "AS IS" BASIS,
     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     See the License for the specific language governing permissions and
     limitations under the License. -->

<!-- Schema for the Test Catalog -->
<!-- Creator: Asad Jawahar -->
<!-- Action item for WG: obtain a namespace URI for the elements -->

<xs:schema
    xmlns:xs='http://www.w3.org/2001/XMLSchema'
   >

	<!-- named types -->
	<xs:complexType name="description">
		<xs:simpleContent>
			<xs:extension base="xs:string">
				<xs:attribute name="last-mod" type="xs:date"/>
			</xs:extension>
		</xs:simpleContent>
	</xs:complexType>

	<!-- base type includes description and note elements -->
	<xs:complexType name="infoBase">
		<xs:sequence>
			<xs:element name="description" type="description" minOccurs="1" maxOccurs="1"/>
			<xs:element name="note" type="xs:string" minOccurs="0" maxOccurs="unbounded"/>
		</xs:sequence>
	</xs:complexType>

	<xs:complexType name = "GroupInfo">
		<xs:sequence>
			<xs:element name="title" type="xs:string"/>
			<xs:element name="description" type="description"/>
			<xs:element name="note" type="xs:string" minOccurs="0" maxOccurs="unbounded"/>
		</xs:sequence>
	</xs:complexType>

	<xs:complexType name="test-case">
		<xs:sequence>
			<xs:element name="description" type="description"/>
			<xs:element name="note" type="xs:string" minOccurs="0" maxOccurs="unbounded"/>
			<xs:element name="spec-citation" minOccurs="1" maxOccurs="unbounded">
				<xs:complexType>
					<xs:simpleContent>
						<xs:extension base="xs:string">
							<xs:attribute name="type" type="citation-type-enum"/>
							<xs:attribute name="place" type="xs:string"/>
							<xs:attribute name="spec" type="citation-spec-enum"/>
							<xs:attribute name="version" type="xs:date"/>
							<xs:attribute name="version-drop" type="xs:date"/>
						</xs:extension>
					</xs:simpleContent>
				</xs:complexType>
			</xs:element>
			<xs:element name="query">
				<xs:complexType>
					<xs:sequence>
						<xs:element name="description" type="description" minOccurs="1" maxOccurs="1"/>
						<xs:element name="note" type="xs:string" minOccurs="0" maxOccurs="unbounded"/>
					</xs:sequence>
					<xs:attribute name="name" type="xs:string"/>
					<xs:attribute name="date" type="xs:date"/>
				</xs:complexType>
			</xs:element>
			<xs:element name="input-file" minOccurs="1" maxOccurs="unbounded">
				<xs:complexType>
					<xs:simpleContent>
						<xs:extension base="xs:IDREF">
							<xs:attribute name="role" type="role-enum"/>
						</xs:extension>
					</xs:simpleContent>
				</xs:complexType>
			</xs:element>
			<xs:element name="output-file" minOccurs="1" maxOccurs="2">
				<xs:complexType>
					<xs:simpleContent>
						<xs:extension base="xs:string">
							<xs:attribute name="role" type="role-enum"/>
							<xs:attribute name="compare" type="comparison-enum"/>
						</xs:extension>
					</xs:simpleContent>
				</xs:complexType>
			</xs:element>
		</xs:sequence>
		<xs:attribute name="name" type="xs:string"/>
		<xs:attribute name="FilePath" type="xs:anyURI"/>
		<xs:attribute name="scenario" type="scenarios-enum"/>
		<xs:attribute name="Creator" type="xs:string"/>
		<xs:attribute name="version-drop" type="xs:date"/>
	</xs:complexType>

	<!-- enum for citation-types -->
	<xs:simpleType name="citation-type-enum">
		<xs:restriction base="xs:string">
			<xs:enumeration value="section"/>
			<xs:enumeration value="anchor"/>
			<xs:enumeration value="XPointer"/>
		</xs:restriction>
	</xs:simpleType>

	<!-- enum for citation-Spec -->
	<xs:simpleType name="citation-spec-enum">
		<xs:restriction base="xs:string">
			<xs:enumeration value="XQuery"/>
			<xs:enumeration value="FuncOps"/>
			<xs:enumeration value="DataModel"/>
			<xs:enumeration value="FormalSemantics"/>
			<xs:enumeration value="SchemaPart2"/>
			<xs:enumeration value="Schema-Errata"/>
			<xs:enumeration value="XPath1"/>
			<xs:enumeration value="XPath1-Errata"/>
			<xs:enumeration value="Namespaces"/>
			<xs:enumeration value="Namespaces-Errata"/>
		</xs:restriction>
	</xs:simpleType>

	<!-- enum for comparisons -->
	<xs:simpleType name="comparison-enum">
		<xs:restriction base="xs:string">
			<xs:enumeration value="XML"/>
			<xs:enumeration value="Text"/>
			<xs:enumeration value="Inspect"/>
			<xs:enumeration value="Ignore"/>
		</xs:restriction>
	</xs:simpleType>

	<!-- enum for roles -->
	<xs:simpleType name="role-enum">
		<xs:restriction base="xs:string">
			<xs:enumeration value="principal-data"/>
			<xs:enumeration value="supplemental-data"/>
			<xs:enumeration value="schema"/>
			<xs:enumeration value="principal"/>
			<xs:enumeration value="console-log"/>
		</xs:restriction>
	</xs:simpleType>

	<!-- enum for scenarios -->
	<xs:simpleType name="scenarios-enum">
		<xs:restriction base="xs:string">
			<xs:enumeration value="standard"/>
			<xs:enumeration value="error"/>
		</xs:restriction>
	</xs:simpleType>


	<!-- top level element -->
	<xs:element name="test-suite">
		<xs:complexType>
			<xs:sequence>
				<xs:element name="citations" minOccurs="1" maxOccurs="1">
					<xs:complexType>
					<xs:choice maxOccurs="unbounded">
						<xs:element name="citation-spec" minOccurs="1">
							<xs:complexType>
							<xs:complexContent>
								<xs:extension base="infoBase">
									<xs:sequence minOccurs="1" maxOccurs="1">
										<xs:element name="spec-URI" type="xs:anyURI"/>
									</xs:sequence>
									<xs:attribute name="name" type="citation-spec-enum"/>
								</xs:extension>
							</xs:complexContent>
							</xs:complexType>
						</xs:element>
						<xs:element name="citation-type" minOccurs="1">
							<xs:complexType>
							<xs:complexContent>
								<xs:extension base="infoBase">
									<xs:attribute name="name" type="citation-type-enum"/>
								</xs:extension>
							</xs:complexContent>
							</xs:complexType>
						</xs:element>
					</xs:choice>
					</xs:complexType>
				</xs:element>
				<xs:element name="comparisons" minOccurs="1" maxOccurs="1">
					<xs:complexType>
						<xs:sequence maxOccurs = "unbounded">
							<xs:element name="comparison" minOccurs="1">
								<xs:complexType>
									<xs:complexContent>
										<xs:extension base="infoBase">
											<xs:attribute name="name" type="comparison-enum"/>
										</xs:extension>
									</xs:complexContent>
								</xs:complexType>
							</xs:element>
						</xs:sequence>
					</xs:complexType>
				</xs:element>

				<xs:element name="roles" minOccurs="1" maxOccurs="1">
					<xs:complexType>
					<xs:sequence maxOccurs="unbounded">
						<xs:element name="role" minOccurs="1">
							<xs:complexType>
							<xs:complexContent>
								<xs:extension base="infoBase">
									<xs:attribute name="name" type="role-enum"/>
								</xs:extension>
							</xs:complexContent>
							</xs:complexType>
						</xs:element>
					</xs:sequence>
					</xs:complexType>
				</xs:element>

				<xs:element name="scenarios" minOccurs="1" maxOccurs="1">
					<xs:complexType>
					<xs:sequence maxOccurs="unbounded">
						<xs:element name="scenario" minOccurs="1">
							<xs:complexType>
							<xs:complexContent>
								<xs:extension base="infoBase">
									<xs:attribute name="name" type="scenarios-enum"/>
								</xs:extension>
							</xs:complexContent>
							</xs:complexType>
						</xs:element>
					</xs:sequence>
					</xs:complexType>
				</xs:element>

				<xs:element name="sources" minOccurs="1" maxOccurs="1">
					<xs:complexType>
					<xs:sequence maxOccurs="unbounded">
						<xs:element name="source" minOccurs="1">
							<xs:complexType>
							<xs:complexContent>
								<xs:extension base="infoBase">
									<xs:attribute name="ID" type="xs:ID"/>
									<xs:attribute name="FileName" type="xs:anyURI"/>
									<xs:attribute name="Creator" type="xs:string"/>
								</xs:extension>
							</xs:complexContent>
							</xs:complexType>
						</xs:element>
					</xs:sequence>
					</xs:complexType>
				</xs:element>

				<xs:element name="test-group" minOccurs="1" maxOccurs="unbounded">
					<xs:complexType>
						<xs:sequence>
							<xs:element name="GroupInfo" type="GroupInfo"/>
							<xs:element name="test-case" type="test-case" minOccurs="0" maxOccurs="unbounded"/>
						</xs:sequence>
						<xs:attribute name="name" type="xs:string"/>
					</xs:complexType>
				</xs:element>

			</xs:sequence>
			<xs:attribute name="CatalogDesignDate" type="xs:date"/>
		</xs:complexType>
	</xs:element>

</xs:schema>





