<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="xsd-documentation.xsl" ?>
<schema xmlns="http://www.w3.org/2001/XMLSchema"
	xmlns:xsd="http://www.w3.org/2001/XMLSchema"
	xmlns:jaxb="http://java.sun.com/xml/ns/jaxb"  jaxb:version="2.0"
	targetNamespace="urn:cansas1d:1.1" xmlns:tns="urn:cansas1d:1.1"
	elementFormDefault="qualified">

<!-- JAXB: http://java.sun.com/developer/technicalArticles/WebServices/jaxb/ -->

	<complexType name="floatUnitType">
		<simpleContent>
			<extension base="float">
				<attribute name="unit" type="string" use="required" />
			</extension>
		</simpleContent>
	</complexType>

	<!-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->

	<group name="positionGroup">
		<sequence>
			<element name="x" type="tns:floatUnitType" minOccurs="0" maxOccurs="1" />
			<element name="y" type="tns:floatUnitType" minOccurs="0" maxOccurs="1" />
			<element name="z" type="tns:floatUnitType" minOccurs="0" maxOccurs="1" />
		</sequence>
	</group>

	<complexType name="positionType">
		<group ref="tns:positionGroup" />
		<attribute name="name" type="string" use="optional" default="" />
	</complexType>

	<group name="orientationGroup">
		<sequence>
			<element name="roll" type="tns:floatUnitType" minOccurs="0"  maxOccurs="1" />
			<element name="pitch" type="tns:floatUnitType" minOccurs="0" maxOccurs="1" />
			<element name="yaw" type="tns:floatUnitType" minOccurs="0"   maxOccurs="1" />
		</sequence>
	</group>

	<complexType name="orientationType">
		<group ref="tns:orientationGroup" />
		<attribute name="name" type="string" use="optional" default="" />
	</complexType>

	<!-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
	
	<complexType name="IdataType">
		<sequence>
			<element name="Q" minOccurs="1" maxOccurs="1"    type="tns:floatUnitType" />
			<element name="I" minOccurs="1" maxOccurs="1"    type="tns:floatUnitType" />
			<element name="Idev" minOccurs="0" maxOccurs="1" type="tns:floatUnitType" default="0" />
			<xsd:choice>
				<!-- [ [Qdev] | [[dQw] | [dQl]] ] -->
				<element name="Qdev" minOccurs="0" maxOccurs="1" type="tns:floatUnitType" default="0" />
				<xsd:sequence>
					<element name="dQw" minOccurs="0" maxOccurs="1" type="tns:floatUnitType" default="0" />
					<element name="dQl" minOccurs="0" maxOccurs="1" type="tns:floatUnitType" default="0" />
				</xsd:sequence>
			</xsd:choice>
			<element name="Qmean" minOccurs="0" maxOccurs="1" type="tns:floatUnitType" default="0" />
			<element name="Shadowfactor" minOccurs="0" maxOccurs="1" type="float" default="1.0" />
			<xsd:any minOccurs="0" maxOccurs="unbounded" processContents="skip" namespace="##other" />
		</sequence>
	</complexType>
	
	<complexType name="SASdataType">
		<sequence minOccurs="1" maxOccurs="1">  <!-- http://svn.cansas.org/trac/ticket/21 -->
			<sequence>
				<element name="Idata" minOccurs="1" maxOccurs="unbounded" type="tns:IdataType" />
			</sequence>
			<xsd:any minOccurs="0" maxOccurs="unbounded" processContents="skip" namespace="##other" />
		</sequence>
		<attribute name="name" type="string" use="optional" default="" />
		<attribute name="timestamp" type="dateTime" use="optional" />
	</complexType>
	
	<!-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
	
	<complexType name="TdataType">
			<sequence>
				<element name="Lambda " minOccurs="1" maxOccurs="1"    type="tns:floatUnitType" />
				<element name="T" minOccurs="1" maxOccurs="1"    type="tns:floatUnitType" />
				<element name="Tdev" minOccurs="0" maxOccurs="1" type="tns:floatUnitType" default="0" />
				<xsd:any minOccurs="0" maxOccurs="unbounded" processContents="skip" namespace="##other" />
		</sequence>
	</complexType>
	
	<complexType name="SAStransmission_spectrumType">
		<sequence minOccurs="1" maxOccurs="1">
			<sequence minOccurs="1" maxOccurs="1">
				<element name="Tdata" minOccurs="1" maxOccurs="unbounded" type="tns:TdataType" />
			</sequence>
			<xsd:any minOccurs="0" maxOccurs="unbounded" processContents="skip" namespace="##other" />
		</sequence>
		<attribute name="name" type="string" use="optional" default="" />
		<attribute name="timestamp" type="dateTime" use="optional" />
	</complexType>
	
	<!-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->

	<complexType name="SASsampleType">
		<sequence>
			<element name="ID" minOccurs="1" maxOccurs="1" type="string" />
			<element name="thickness" minOccurs="0" maxOccurs="1" type="tns:floatUnitType" />
			<element name="transmission" minOccurs="0" maxOccurs="1" type="float" />
			<element name="temperature" minOccurs="0" maxOccurs="1" type="tns:floatUnitType" />
			<element name="position" minOccurs="0" maxOccurs="1" type="tns:positionType" />
			<element name="orientation" minOccurs="0" maxOccurs="1" type="tns:orientationType" />
			<element name="details" minOccurs="0" maxOccurs="unbounded" />
			<xsd:any minOccurs="0" maxOccurs="unbounded" processContents="skip" namespace="##other" />
		</sequence>
		<attribute name="name" type="string" use="optional" default="" />
	</complexType>

	<!-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->

	<complexType name="termType">
		<simpleContent>
			<extension base="string">
				<attribute name="name" type="string" use="optional" default="" />
				<attribute name="unit" type="string" use="optional"/>
			</extension>
		</simpleContent>
	</complexType>

	<!-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->

	<complexType name="SASprocessType">
		<annotation>
			<appinfo>
				<!-- JAXB: simplify class name -->
				<jaxb:property name="SASprocess" />
			</appinfo>
		</annotation>
		<sequence>
			<element name="name" minOccurs="0" maxOccurs="1"
				type="string" default="">
				<annotation>
					<appinfo>
						<!-- Remap collision of Name when using JAXB -->
						<jaxb:property name="SASprocessName" />
					</appinfo>
				</annotation>
			</element>
			<element name="date" minOccurs="0" maxOccurs="1" type="string" />
			<element name="description" minOccurs="0" maxOccurs="1" />
			<element name="term" minOccurs="0" maxOccurs="unbounded" type="tns:termType" />
			<element name="SASprocessnote" minOccurs="1" maxOccurs="unbounded" />
			<xsd:any minOccurs="0" maxOccurs="unbounded" processContents="skip" namespace="##other" />
		</sequence>
		<attribute name="name" type="string" use="optional" default="">
			<annotation>
				<appinfo>
					<!-- Remap collision of Name when using JAXB -->
					<jaxb:property name="SASprocessNameAttr" />
				</appinfo>
			</annotation>
		</attribute>
	</complexType>

	<!-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->

	<complexType name="SASsourceType">
		<sequence>
			<element name="radiation" minOccurs="1" maxOccurs="1" type="string" />
			<element name="beam_size" minOccurs="0" maxOccurs="1" type="tns:positionType" />
			<element name="beam_shape" minOccurs="0" maxOccurs="1" type="string" />
			<element name="wavelength" minOccurs="0" maxOccurs="1" type="tns:floatUnitType" />
			<element name="wavelength_min" minOccurs="0" maxOccurs="1" type="tns:floatUnitType" />
			<element name="wavelength_max" minOccurs="0" maxOccurs="1" type="tns:floatUnitType" />
			<element name="wavelength_spread" minOccurs="0" maxOccurs="1" type="tns:floatUnitType" />
		</sequence>
		<attribute name="name" type="string" use="optional" default="" />
	</complexType>

	<complexType name="SAScollimationType">
		<sequence>
			<element name="length" minOccurs="0" maxOccurs="1" type="tns:floatUnitType" />
			<element name="aperture" minOccurs="0"
				maxOccurs="unbounded">
				<complexType>
					<sequence>
						<element name="size" minOccurs="0" maxOccurs="1" type="tns:positionType" />
						<element name="distance" minOccurs="0" maxOccurs="1" type="tns:floatUnitType" />
					</sequence>
					<attribute name="name" type="string" use="optional" default="" />
					<attribute name="type" type="string" use="optional" default="" />
				</complexType>
			</element>
		</sequence>
		<attribute name="name" type="string" use="optional" default="" />
	</complexType>

	<complexType name="SASdetectorType">
		<sequence>
			<element name="name" minOccurs="1" maxOccurs="1" type="string" default=""/>
			<element name="SDD" minOccurs="0" maxOccurs="1" type="tns:floatUnitType" />
			<element name="offset" minOccurs="0" maxOccurs="1" type="tns:positionType" />
			<element name="orientation" minOccurs="0" maxOccurs="1" type="tns:orientationType" />
			<element name="beam_center" minOccurs="0" maxOccurs="1" type="tns:positionType" />
			<element name="pixel_size" minOccurs="0" maxOccurs="1" type="tns:positionType" />
			<element name="slit_length" minOccurs="0" maxOccurs="1" type="tns:floatUnitType" />
		</sequence>
	</complexType>

	<complexType name="SASinstrumentType">
		<sequence>
			<element name="name" type="string" minOccurs="1" maxOccurs="1" default="" />
			<element name="SASsource" type="tns:SASsourceType" minOccurs="1" maxOccurs="1" />
			<element name="SAScollimation" type="tns:SAScollimationType" minOccurs="1" maxOccurs="unbounded" />
			<element name="SASdetector" type="tns:SASdetectorType" minOccurs="1" maxOccurs="unbounded" />
		</sequence>
	</complexType>

	<!-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->

	<complexType name="SASentryType">
		<sequence>
			<element name="Title" minOccurs="1" maxOccurs="1" type="string" />
			<element name="Run" minOccurs="1" maxOccurs="unbounded">
				<xsd:complexType>
					<simpleContent>
						<extension base="string">
							<attribute name="name" type="string" use="optional" default="" />
						</extension>
					</simpleContent>
				</xsd:complexType>
			</element>
			<xsd:any minOccurs="0" maxOccurs="unbounded" processContents="skip" namespace="##other" />
			<element name="SASdata" minOccurs="1" maxOccurs="unbounded" type="tns:SASdataType" />
			<element name="SAStransmission_spectrum" minOccurs="0" maxOccurs="unbounded" type="tns:SAStransmission_spectrumType"/>
			<xsd:any minOccurs="0" maxOccurs="unbounded" processContents="skip" namespace="##other">
				<!-- Is a second *any* element needed here? -->
				<annotation>
					<appinfo>
						<!-- Remap collision of Any when using JAXB --> 
						<jaxb:property name="SASentryAny2" />
					</appinfo>
				</annotation>
			</xsd:any>
			<element name="SASsample" type="tns:SASsampleType" />
			<element name="SASinstrument" type="tns:SASinstrumentType" minOccurs="1" maxOccurs="1" />
			<element name="SASprocess" type="tns:SASprocessType" minOccurs="0" maxOccurs="unbounded" />
			<element name="SASnote" minOccurs="1" maxOccurs="unbounded" />
				<!-- SASnote is a free-form element.
					Do not define any content for it or it will become restrictive.
				-->
		</sequence>
		<attribute name="name" type="string" use="optional" default="" />
	</complexType>

	<!-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->

	<complexType name="SASrootType">
		<sequence>
			<element name="SASentry" minOccurs="1" maxOccurs="unbounded" type="tns:SASentryType" />
		</sequence>
		<attribute name="version" type="string" fixed="1.1" use="required" />
	</complexType>

	<element name="SASroot" type="tns:SASrootType" />

</schema>