<?xml version="1.0" encoding="utf-8"?>
<xs:schema xmlns:rdml="http://www.rdml.org"
           elementFormDefault="qualified" 
           targetNamespace="http://www.rdml.org"
           xmlns:xs="http://www.w3.org/2001/XMLSchema"> 

 <xs:annotation>
   <xs:documentation>
     The MIT License

     Copyright (c) 2008 the RDML-consortium

     Permission is hereby granted, free of charge, to any person obtaining a copy
     of this software and associated documentation files (the "Software"), to deal
     in the Software without restriction, including without limitation the rights
     to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
     copies of the Software, and to permit persons to whom the Software is
     furnished to do so, subject to the following conditions:

     The above copyright notice and this permission notice shall be included in
     all copies or substantial portions of the Software.

     THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
     IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
     FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
     AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
     LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
     OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
     THE SOFTWARE.
   </xs:documentation>
 </xs:annotation>

 <xs:complexType name="cdnaSynthesisMethodType">
   <xs:annotation>
     <xs:documentation>
       Description of the cDNA synthesis method.
     </xs:documentation>
   </xs:annotation>
   <xs:sequence>
     <xs:element name="enzyme" type="xs:string" minOccurs="0">
       <xs:annotation>
         <xs:documentation>
           Enzyme used for reverse transcription. 
         </xs:documentation>
       </xs:annotation>
     </xs:element>
     <xs:element name="primingMethod" type="rdml:primingMethodType" minOccurs="0"/>
     <xs:element name="dnaseTreatment" type="xs:boolean" minOccurs="0">
       <xs:annotation>
         <xs:documentation>
           True if RNA was DNAse treated prior cDNA synthesis.
         </xs:documentation>
       </xs:annotation>
     </xs:element>
     <xs:element name="thermalCyclingConditions" type="rdml:idReferencesType" minOccurs="0"/>
   </xs:sequence>
 </xs:complexType>

 <xs:complexType name="commercialAssayType">
   <xs:annotation>
     <xs:documentation>
       For some commercial assays the primer sequences may be unknown. This element 
       allows to describe commercial assays.
     </xs:documentation>
   </xs:annotation>
   <xs:sequence>
     <xs:element name="company" type="xs:string"/>
     <xs:element name="orderNumber" type="xs:string"/>
   </xs:sequence>
 </xs:complexType>

 <xs:simpleType name="cqDetectionMethodType">
   <xs:annotation>
     <xs:documentation>
       The method used to determine the cq value.
     </xs:documentation>
   </xs:annotation>
   <xs:restriction base="xs:string">
     <xs:enumeration value="automated threshold and baseline settings"/>
     <xs:enumeration value="manual threshold and baseline settings"/>
     <xs:enumeration value="second derivative maximum"/>
     <xs:enumeration value="other"/>
   </xs:restriction>
 </xs:simpleType>

 <xs:complexType name="dataCollectionSoftwareType">
   <xs:annotation>
     <xs:documentation>
       Software name and version used to collect the data.
     </xs:documentation>
   </xs:annotation>
   <xs:sequence>
     <xs:element name="name" type="xs:string"/>
     <xs:element name="version" type="xs:string"/>
   </xs:sequence>
 </xs:complexType>

 <xs:complexType name="dataType">
   <xs:annotation>
     <xs:documentation>
       Due to the high numbers of this elements names are kept short.
     </xs:documentation>
   </xs:annotation>
   <xs:sequence>
     <xs:element name="tar" type="rdml:idReferencesType">
       <xs:annotation>
         <xs:documentation>
           TargetID - A reference to a target. 
         </xs:documentation>
       </xs:annotation>
     </xs:element>
     <xs:element name="cq" type="xs:float" minOccurs="0">
       <xs:annotation>
         <xs:documentation>
           Quantification cycle - The calculated fractional cycle where 
           amplification was detected.
         </xs:documentation>
       </xs:annotation>
     </xs:element>
     <xs:element name="quantity" type="rdml:quantityType" minOccurs="0">
       <xs:annotation>
         <xs:documentation>
           Quantity - A calculated quantity based on the quantity provided with
           the standard samples.
         </xs:documentation>
       </xs:annotation>
     </xs:element>
     <xs:element name="excl" type="xs:string" minOccurs="0">
       <xs:annotation>
         <xs:documentation>
           Excluded - Present if this entry should not be evaluated. It can contain
           an string with an explanation why it was excluded.
         </xs:documentation>
       </xs:annotation>
     </xs:element>
     <xs:element name="adp" type="rdml:dpAmpCurveType" maxOccurs="unbounded" minOccurs="0">
       <xs:annotation>
         <xs:documentation>
           Amplification data point - The single data points measured during amplification.
         </xs:documentation>
       </xs:annotation>
     </xs:element>
     <xs:element name="mdp" type="rdml:dpMeltingCurveType" maxOccurs="unbounded" minOccurs="0">
       <xs:annotation>
         <xs:documentation>
           Melting curve data point - The single data points measured in the melting analysis.
         </xs:documentation>
       </xs:annotation>
     </xs:element>
     <xs:element name="endPt" type="xs:float" minOccurs="0">
       <xs:annotation>
         <xs:documentation>
           End point - Result of an endpoint measurement.
         </xs:documentation>
       </xs:annotation>
     </xs:element>
     <xs:element name="bgFluor" type="xs:float" minOccurs="0">
       <xs:annotation>
         <xs:documentation>
           Background fluorescence - The measured background fluorescence.
         </xs:documentation>
       </xs:annotation>
     </xs:element>
     <xs:element name="quantFluor" type="xs:float" minOccurs="0">
       <xs:annotation>
         <xs:documentation>
           Quantification flourescence - The fluorescence corresponding to the treshold line.
         </xs:documentation>
       </xs:annotation>
     </xs:element>
   </xs:sequence>
 </xs:complexType>

 <xs:complexType name="documentationType">
   <xs:annotation>
     <xs:documentation>
       These elements should be used if the same description applies to many samples, 
       targets or experiments.
     </xs:documentation>
   </xs:annotation>
   <xs:all>
     <xs:element name="text" type="xs:string" minOccurs="0"/>
   </xs:all>
   <xs:attribute name="id" type="rdml:idType" use="required"/>
 </xs:complexType>

 <xs:complexType name="dpAmpCurveType">
   <xs:annotation>
     <xs:documentation>
       Due to the high numbers of this element, names are kept short.
     </xs:documentation>
   </xs:annotation>
   <xs:sequence>
     <xs:element name="cyc" type="xs:float">
       <xs:annotation>
         <xs:documentation>
           Cycle - The cycle of this data point.
         </xs:documentation>
       </xs:annotation>
     </xs:element>
     <xs:element name="tmp" type="xs:float" minOccurs="0">
       <xs:annotation>
         <xs:documentation>
           Temperature - The temperature in Celsius at the time of measurement.
         </xs:documentation>
       </xs:annotation>
     </xs:element>
     <xs:element name="fluor" type="xs:float">
       <xs:annotation>
         <xs:documentation>
           Fluorescence - The fluorescence measured.
         </xs:documentation>
       </xs:annotation>
     </xs:element>
   </xs:sequence>
 </xs:complexType>

 <xs:complexType name="dpMeltingCurveType">
   <xs:annotation>
     <xs:documentation>
       Due to the high numbers of this element, names are kept short.
     </xs:documentation>
   </xs:annotation>
   <xs:sequence>
     <xs:element name="tmp" type="xs:float">
       <xs:annotation>
         <xs:documentation>
           Temperature - The temperature in Celsius of this data point.
         </xs:documentation>
       </xs:annotation>
     </xs:element>
     <xs:element name="fluor" type="xs:float">
       <xs:annotation>
         <xs:documentation>
           Fluorescence - The fluorescence measured.
         </xs:documentation>
       </xs:annotation>
     </xs:element>
   </xs:sequence>
 </xs:complexType>

 <xs:complexType name="experimenterType">
   <xs:annotation>
     <xs:documentation>
       Contact details of an experimenter.
     </xs:documentation>
   </xs:annotation>
   <xs:sequence>
     <xs:element name="firstName" type="xs:string"/>
     <xs:element name="lastName" type="xs:string"/>
     <xs:element name="email" type="xs:string" minOccurs="0"/>
     <xs:element name="labName" type="xs:string" minOccurs="0"/>
     <xs:element name="labAddress" type="xs:string" minOccurs="0"/>
   </xs:sequence>
   <xs:attribute name="id" type="rdml:idType" use="required"/>
 </xs:complexType>

 <xs:complexType name="experimentType">
   <xs:annotation>
     <xs:documentation>
       An experiment can contain several independent runs.
     </xs:documentation>
   </xs:annotation>
   <xs:sequence>
     <xs:element name="description" type="xs:string" minOccurs="0"/>
     <xs:element name="documentation" type="rdml:idReferencesType" minOccurs="0" maxOccurs="unbounded"/>
     <xs:element name="run" type="rdml:runType" minOccurs="0" maxOccurs="unbounded">
       <xs:unique name="runUniId">
         <xs:annotation>
           <xs:documentation>
             react id within the run must be unique.
           </xs:documentation>
         </xs:annotation>
         <xs:selector xpath="./rdml:react" />
         <xs:field xpath="@id" />
       </xs:unique>
       <xs:unique name="runDocumentationId">
         <xs:annotation>
           <xs:documentation>
             Documentation references within the run types must be unique.
           </xs:documentation>
         </xs:annotation>
         <xs:selector xpath="./rdml:documentation" />
         <xs:field xpath="@id" />
       </xs:unique>
       <xs:unique name="runExperimenterId">
         <xs:annotation>
           <xs:documentation>
             Experimenter references within the run types must be unique.
           </xs:documentation>
         </xs:annotation>
         <xs:selector xpath="./rdml:experimenter" />
         <xs:field xpath="@id" />
       </xs:unique>
     </xs:element>
   </xs:sequence>
   <xs:attribute name="id" type="rdml:idType" use="required"/>
 </xs:complexType>

 <xs:complexType name="gradientType">
   <xs:annotation>
     <xs:documentation>
       This step forms a temperature gradient on the heat block.
     </xs:documentation>
   </xs:annotation>
   <xs:sequence>
     <xs:element name="highTemperature" type="xs:float">
       <xs:annotation>
         <xs:documentation>
           The high temperature of the gradient in Celsius.
         </xs:documentation>
       </xs:annotation>
     </xs:element>
     <xs:element name="lowTemperature" type="xs:float">
       <xs:annotation>
         <xs:documentation>
           The low temperature of the gradient in Celsius.
         </xs:documentation>
       </xs:annotation>
     </xs:element>
     <xs:element name="duration" type="xs:positiveInteger">
       <xs:annotation>
         <xs:documentation>
           The duration of this step in seconds.
         </xs:documentation>
       </xs:annotation>
     </xs:element>
     <xs:element name="temperatureChange" type="xs:float" minOccurs="0">
       <xs:annotation>
         <xs:documentation>
           The change of the temperature from one cycle to the next:
           actual highTemperature = highTemperature + (temperatureChange * cycle couter)
           actual lowTemperature = lowTemperature + (temperatureChange * cycle couter)
         </xs:documentation>
       </xs:annotation>
     </xs:element>
     <xs:element name="durationChange" type="xs:int" minOccurs="0">
       <xs:annotation>
         <xs:documentation>
           The change of the duration from one cycle to the next:
           actual duration = duration + (durationChange * cycle couter)
         </xs:documentation>
       </xs:annotation>
     </xs:element>
     <xs:element name="measure" type="rdml:measureType" minOccurs="0">
       <xs:annotation>
         <xs:documentation>
           Make a measurement and store it as meltcurve or realtime data.
         </xs:documentation>
       </xs:annotation>
     </xs:element>
     <xs:element name="ramp" type="xs:float" minOccurs="0">
       <xs:annotation>
         <xs:documentation>
           The temperature change from one step to the next in
           Celsius per second. No value means maximal change rate.
         </xs:documentation>
       </xs:annotation>
     </xs:element>
   </xs:sequence>
 </xs:complexType>

 <xs:complexType name="idReferencesType">
   <xs:attribute name="id" type="rdml:idType" use="required"/>
 </xs:complexType>

 <xs:simpleType name="idType">
   <xs:annotation>
     <xs:documentation>
       A ID must be at least one character and unique.
     </xs:documentation>
   </xs:annotation>
   <xs:restriction base ="xs:string">
     <xs:minLength value="1"/>
   </xs:restriction>
 </xs:simpleType>

 <xs:complexType name="lidOpenType">
   <xs:annotation>
     <xs:documentation>
       This step waits for the user to open the lid and continues after. It
       allows to stop the program and to wait for the user to add for example 
       enzymes and continue the program after. The temperature of the previous
       step is maintained.
     </xs:documentation>
   </xs:annotation>
 </xs:complexType>

 <xs:complexType name="loopType">
   <xs:annotation>
     <xs:documentation>
       This step allows to form a loop or to exclude some steps. It allows to
       jump to a certain "goto" step for "repeat" times. If the "goto" step is  
       higher than the step of the loop, "repeat" must be "0".
     </xs:documentation>
   </xs:annotation>
   <xs:sequence>
     <xs:element name="goto" type="xs:positiveInteger">
       <xs:annotation>
         <xs:documentation>
           The step to go to forming the loop.
         </xs:documentation>
       </xs:annotation>
     </xs:element>
     <xs:element name="repeat" type="xs:positiveInteger">
       <xs:annotation>
         <xs:documentation>
           How often the loop is repeated. The first run through the loop is 
           counted as 0, the last loop is "repeat" - 1. The loop is run 
           through exactly "repeat" times.
         </xs:documentation>
       </xs:annotation>
     </xs:element>
   </xs:sequence>
 </xs:complexType>

 <xs:simpleType name="measureType">
   <xs:restriction base="xs:string">
     <xs:enumeration value="real time"/>
     <xs:enumeration value="meltcurve"/>
   </xs:restriction>
 </xs:simpleType>

 <xs:complexType name="oligoType">
   <xs:sequence>
     <xs:element name="threePrimeTag" type="xs:string" minOccurs="0">
       <xs:annotation>
         <xs:documentation>
           Description of three prime modifications if present.
         </xs:documentation>
       </xs:annotation>
     </xs:element>
     <xs:element name="fivePrimeTag" type="xs:string" minOccurs="0">
       <xs:annotation>
         <xs:documentation>
           Description of five prime modifications if present.
         </xs:documentation>
       </xs:annotation>
     </xs:element>
     <xs:element name="sequence" type="rdml:sequenceType"/>
   </xs:sequence>
 </xs:complexType>

 <xs:complexType name="pauseType">
   <xs:annotation>
     <xs:documentation>
       This step allows to pause at a certain temperature. It is typically the
       last step in an amplification protocol.  
     </xs:documentation>
   </xs:annotation>
   <xs:sequence>
     <xs:element name="temperature" type="xs:float">
       <xs:annotation>
         <xs:documentation>
           The temperature in Celsius to maintain during the pause.
         </xs:documentation>
       </xs:annotation>
     </xs:element>
   </xs:sequence>
 </xs:complexType>

 <xs:simpleType name="pcrFormatType">
   <xs:annotation>
     <xs:documentation>
       The format of the assay - This allows the software to display the data
       in a way which resembles the machine sample format. Due to technical 
       improvements this list is likely to expand. Software should be able 
       handle a "pcrFormatType" not listed here by teating them as 
       "free format".
       It is required to label the "id" in "react" according to the pattern
       give in the enumeration. For example if "96-well plate; A1-H12" is
       selected a valid "id" in "react" must be in the range of "A1" to "H12".
     </xs:documentation>
   </xs:annotation>
   <xs:restriction base="xs:string">
     <xs:enumeration value="single-well; 1"/>
     <xs:enumeration value="48-well plate; A1-F8"/>
     <xs:enumeration value="96-well plate; A1-H12"/>
     <xs:enumeration value="384-well plate; A1-P24"/>
     <xs:enumeration value="3072-well plate; A1a1-D12h8"/>
     <xs:enumeration value="32-well rotor; 1-32"/>
     <xs:enumeration value="72-well rotor; 1-72"/>
     <xs:enumeration value="100-well rotor; 1-100"/>
     <xs:enumeration value="free format"/>
   </xs:restriction>
 </xs:simpleType>

 <xs:simpleType name="primingMethodType">
   <xs:annotation>
     <xs:documentation>
       The primers used to reverse transcribe the RNA to cDNA.
     </xs:documentation>
   </xs:annotation>
   <xs:restriction base="xs:string">
     <xs:enumeration value="oligo-dt"/>
     <xs:enumeration value="random"/>
     <xs:enumeration value="target-specific"/>
     <xs:enumeration value="oligo-dt and random"/>
   </xs:restriction>
 </xs:simpleType>

 <xs:complexType name="quantityType">
   <xs:annotation>
     <xs:documentation>
       A quantity is always defined by its value and its unit.  
     </xs:documentation>
   </xs:annotation>
   <xs:sequence>
     <xs:element name="value" type="xs:float"/>
     <xs:element name="unit" type="rdml:quantityUnitType"/>
   </xs:sequence>
 </xs:complexType>

 <xs:simpleType name="quantityUnitType">
   <xs:annotation>
     <xs:documentation>
       The unit the quantity
       cop   - copies per microliter  
       fold  - fold change  
       dil   - dilution (10 would mean 1:10 dilution)  
       nMol  - nanomol per microliter 
       ng    - nanogram per microliter 
       other - other unit (must be linear, no exponents or logarithms allowed) 
     </xs:documentation>
   </xs:annotation>
   <xs:restriction base="xs:string">
     <xs:enumeration value="cop"/>
     <xs:enumeration value="fold"/>
     <xs:enumeration value="dil"/>
     <xs:enumeration value="ng"/>
     <xs:enumeration value="nMol"/>
     <xs:enumeration value="other"/>
   </xs:restriction>
 </xs:simpleType>

 <xs:complexType name="rdmlIdType">
   <xs:annotation>
     <xs:documentation>
       This element can be used to assign an publisher and id to the RDML file.
     </xs:documentation>
   </xs:annotation>
   <xs:sequence>
     <xs:element name="publisher" type="xs:string"/>
     <xs:element name="serialNumber" type="xs:string"/>
     <xs:element name="MD5Hash" type="xs:string" minOccurs="0">
       <xs:annotation>
         <xs:documentation>
           An MD5Hash calculated over the complete file after removing all
           rdmlIDTypes and all whitespaces between elements.
         </xs:documentation>
       </xs:annotation>
     </xs:element>
   </xs:sequence>
 </xs:complexType>

 <xs:complexType name="reactType">
   <xs:annotation>
     <xs:documentation>
       A reaction is an independent chemical reaction corresponding for example
       to a well in a 96 well plate, a capillary in a rotor or a droplet on the
       biotrophe slides. 
     </xs:documentation>
   </xs:annotation>
   <xs:sequence>
     <xs:element name="sample" type="rdml:idReferencesType">
       <xs:annotation>
         <xs:documentation>
           SampleID - A reference to a sample.
         </xs:documentation>
       </xs:annotation>
     </xs:element>
     <xs:element name="data" type="rdml:dataType" maxOccurs="unbounded">
       <xs:unique name="adpCycUnique">
         <xs:annotation>
           <xs:documentation>
             cyc within the adp must be unique.
           </xs:documentation>
         </xs:annotation>
         <xs:selector xpath="./rdml:adp" />
         <xs:field xpath="rdml:cyc" />
       </xs:unique>
       <xs:unique name="mdpTmpUnique">
         <xs:annotation>
           <xs:documentation>
             tmp within the mdp must be unique.
           </xs:documentation>
         </xs:annotation>
         <xs:selector xpath="./rdml:mdp" />
         <xs:field xpath="rdml:tmp" />
       </xs:unique>
     </xs:element>
   </xs:sequence>
   <xs:attribute name="id" type="rdml:idType" use="required">
     <xs:annotation>
       <xs:documentation>
         The ID of this reaction - The ID can be only assigned freely if 
         "pcrFormatType" is "free format". Otherwhise it is required to 
         label the "id" according to the pattern give in "pcrFormatType".
         For example if "96-well plate; A1-H12" is selected a valid "id"
         must be in the range of "A1" to "H12".
       </xs:documentation>
     </xs:annotation>
   </xs:attribute>
 </xs:complexType>

 <xs:complexType name="runType">
   <xs:annotation>
     <xs:documentation>
       A run is a set of reactions performed in one "run", for example 
       one plate, a slide in a biotrophe or one rotor. 
     </xs:documentation>
   </xs:annotation>
   <xs:sequence>
     <xs:element name="description" type="xs:string" minOccurs="0"/>
     <xs:element name="documentation" type="rdml:idReferencesType" minOccurs="0" maxOccurs="unbounded"/>
     <xs:element name="experimenter" type="rdml:idReferencesType" minOccurs="0" maxOccurs="unbounded"/>
     <xs:element name="instrument" type="xs:string" minOccurs="0">
       <xs:annotation>
         <xs:documentation>
           Description of the instrument used to aquire the data.
         </xs:documentation>
       </xs:annotation>
     </xs:element>
     <xs:element name="dataCollectionSoftware" type="rdml:dataCollectionSoftwareType" minOccurs="0">
       <xs:annotation>
         <xs:documentation>
           Description of the software used to aquire the data.
         </xs:documentation>
       </xs:annotation>
     </xs:element>
     <xs:element name="backgroundDeterminationMethod" type="xs:string" minOccurs="0">
       <xs:annotation>
         <xs:documentation>
           Description of method used to determine the background.
         </xs:documentation>
       </xs:annotation>
     </xs:element>
     <xs:element name="cqDetectionMethod" type="rdml:cqDetectionMethodType" minOccurs="0">
       <xs:annotation>
         <xs:documentation>
           Description of method used to calculate the quantification cycle.
         </xs:documentation>
       </xs:annotation>
     </xs:element>
     <xs:element name="thermalCyclingConditions" type="rdml:idReferencesType" minOccurs="0">
       <xs:annotation>
         <xs:documentation>
           The program used to aquire the data.
         </xs:documentation>
       </xs:annotation>
     </xs:element>
     <xs:element name="pcrFormat" type="rdml:pcrFormatType"/>
     <xs:element name="runDate" type="xs:dateTime" minOccurs="0">
       <xs:annotation>
         <xs:documentation>
           Date and time stamp when the data was aquired.
         </xs:documentation>
       </xs:annotation>
     </xs:element>
     <xs:element name="react" type="rdml:reactType" maxOccurs="unbounded" minOccurs="0">
       <xs:unique name="dataTarID">
         <xs:annotation>
           <xs:documentation>
             tarID within the data must be unique.
           </xs:documentation>
         </xs:annotation>
         <xs:selector xpath="./rdml:data/rdml:tar" />
         <xs:field xpath="@id" />
       </xs:unique>
     </xs:element>
   </xs:sequence>
   <xs:attribute name="id" type="rdml:idType" use="required"/>
 </xs:complexType>

 <xs:complexType name="sampleType">
   <xs:annotation>
     <xs:documentation>
       A sample is a defined template solution. Dilutions of the same stock 
       material differ in concentration and are considered different samples.
       A technical replicate samples should contain the same name (reactions 
       are performed on the same material), and biological replicates should 
       contain different names (the nucleic acids derived from the different 
       biological replicates are not the same). 
     </xs:documentation>
   </xs:annotation>
   <xs:sequence>
     <xs:element name="description" type="xs:string" minOccurs="0"/>
     <xs:element name="documentation" type="rdml:idReferencesType" minOccurs="0" maxOccurs="unbounded"/>
     <xs:element name="xRef" type="rdml:xRefType" minOccurs="0" maxOccurs="unbounded"/>
     <xs:element name="type" type="rdml:sampleTypeType" default="unkn"/>
     <xs:element name="interRunCalibrator" type="xs:boolean" default="false" minOccurs="0">
       <xs:annotation>
         <xs:documentation>
           True if this sample should be used as inter run calibrator
         </xs:documentation>
       </xs:annotation>
     </xs:element>
     <xs:element name="quantity" type="rdml:quantityType" minOccurs="0">
       <xs:annotation>
         <xs:documentation>
           Quantity - The reference quantity of this sample. This element only makes sense
           if the "type" is "std" or "opt". If the "type" is "std" this value should give 
           a copy number or DNA concentration. Only the use of true numbers is valid like 
           1, 10, 100, 1000 or 1, 0.1, 0.01, 0.001. The use of exponents is not valid like
           1, 2, 3, 4 or -1, -2, -3, -4 beause it will not be interpreted as 10E1, 10E2, 
           10E3, 10E4 or 10E-1, 10E-2, 10E-3. If the "type" is "opt" this value should give 
           the DNA concentration in nanogram / microliter. Use quantUnit to indicate the 
           unit.
         </xs:documentation>
       </xs:annotation>
     </xs:element>
     <xs:element name="calibratorSample" type="xs:boolean" default="false" minOccurs="0">
       <xs:annotation>
         <xs:documentation>
           True if this sample was used as calibrator sample
         </xs:documentation>
       </xs:annotation>
     </xs:element>
     <xs:element name="cdnaSynthesisMethod" type="rdml:cdnaSynthesisMethodType" minOccurs="0"/>
     <xs:element name="templateRNAQuantity" type="xs:double" minOccurs="0">
       <xs:annotation>
         <xs:documentation>
           The equivalent RNA concentration in nanogram / microliter in the reaction mix.
         </xs:documentation>
       </xs:annotation>
     </xs:element>
     <xs:element name="templateRNAQuality" type="rdml:templateQualityType" minOccurs="0"/>
     <xs:element name="templateDNAQuantity" type="xs:double" minOccurs="0">
       <xs:annotation>
         <xs:documentation>
           The template DNA concetration in nanogram / microliter in the reaction mix.
         </xs:documentation>
       </xs:annotation>
     </xs:element>
     <xs:element name="templateDNAQuality" type="rdml:templateQualityType" minOccurs="0"/>
   </xs:sequence>
   <xs:attribute name="id" type="rdml:idType" use="required"/>
 </xs:complexType>

 <xs:simpleType name="sampleTypeType">
   <xs:annotation>
     <xs:documentation>
       unkn - unknown sample
       ntc  - non template control
       nac  - no amplification control
       std  - standard sample
       opt  - optical calibrator sample
     </xs:documentation>
   </xs:annotation>
   <xs:restriction base="xs:string">
     <xs:enumeration value="unkn"/>
     <xs:enumeration value="ntc"/>
     <xs:enumeration value="nac"/>
     <xs:enumeration value="std"/>
     <xs:enumeration value="opt"/>
   </xs:restriction>
 </xs:simpleType>

 <xs:simpleType name="sequenceType">
   <xs:restriction base="xs:string">
     <xs:pattern value="([a|c|g|t|r|y|s|w|k|m|b|d|h|v|n|A|C|G|T|R|Y|S|W|K|M|B|D|H|V|N]+)">
       <xs:annotation>
         <xs:documentation>
           All the IUPAC codes :

           A         Adenine
           C         Cytosine
           G         Guanine
           T (or U)  Thymine (or Uracil)
           R         A or G
           Y         C or T
           S         G or C
           W         A or T
           K         G or T
           M         A or C
           B         C or G or T
           D         A or G or T
           H         A or C or T
           V         A or C or G
           N         any base
         </xs:documentation>
       </xs:annotation>
     </xs:pattern>
   </xs:restriction>
 </xs:simpleType>

 <xs:complexType name="sequencesType">
   <xs:sequence>
     <xs:element name="forwardPrimer" type="rdml:oligoType" minOccurs="0"/>
     <xs:element name="reversePrimer" type="rdml:oligoType" minOccurs="0"/>
     <xs:element name="probe1" type="rdml:oligoType" minOccurs="0"/>
     <xs:element name="probe2" type="rdml:oligoType" minOccurs="0"/>
     <xs:element name="amplicon" type="rdml:oligoType" minOccurs="0"/>
   </xs:sequence>
 </xs:complexType>

 <xs:simpleType name="stepNumberType">
   <xs:restriction base="xs:positiveInteger">
     <xs:minInclusive value="1"/>
   </xs:restriction>
 </xs:simpleType>

 <xs:complexType name="stepType">
   <xs:sequence>
     <xs:element name="nr" type="rdml:stepNumberType">
       <xs:annotation>
         <xs:documentation>
           The incremental number of the step. First step should be nr = 1 and then 
           increment each step by + 1.
         </xs:documentation>
       </xs:annotation>
     </xs:element>
     <xs:element name="description" type="xs:string" minOccurs="0"/>
     <xs:choice>
       <xs:element name="temperature" type="rdml:temperatureType"/>
       <xs:element name="gradient" type="rdml:gradientType"/>
       <xs:element name="loop" type="rdml:loopType"/>
       <xs:element name="pause" type="rdml:pauseType"/>
       <xs:element name="lidOpen" type="rdml:lidOpenType"/>
     </xs:choice>
   </xs:sequence>
 </xs:complexType>

 <xs:complexType name="targetType">
   <xs:annotation>
     <xs:documentation>
       A target is a defined PCR reaction. PCR reactions at the same gene 
       which differ in primer sequences are considered different samples. 
     </xs:documentation>
   </xs:annotation>
   <xs:sequence>
     <xs:element name="description" type="xs:string" minOccurs="0"/>
     <xs:element name="documentation" type="rdml:idReferencesType" minOccurs="0" maxOccurs="unbounded"/>
     <xs:element name="xRef" type="rdml:xRefType" minOccurs="0" maxOccurs="unbounded"/>
     <xs:element name="type" type="rdml:targetTypeType"/>
     <xs:element name="amplificationEfficiency" type="xs:float" minOccurs="0">
       <xs:annotation>
         <xs:documentation>
           Amplification efficiency for the primer set is given as the exponent to the base 2.
         </xs:documentation>
       </xs:annotation>
     </xs:element>
     <xs:element name="detectionLimit" type="xs:float" minOccurs="0">
       <xs:annotation>
         <xs:documentation>
           The detection limit is given in copies per microliter.
         </xs:documentation>
       </xs:annotation>
     </xs:element>
     <xs:element name="dyeId" type="xs:string" minOccurs="0">
       <xs:annotation>
         <xs:documentation>
           Description of the dye.
         </xs:documentation>
       </xs:annotation>
     </xs:element>
     <xs:element name="sequences" type="rdml:sequencesType" minOccurs="0"/>
     <xs:element name="commercialAssay" type="rdml:commercialAssayType" minOccurs="0"/>
   </xs:sequence>
   <xs:attribute name="id" type="rdml:idType" use="required"/>
 </xs:complexType>

 <xs:simpleType name="targetTypeType">
   <xs:annotation>
     <xs:documentation>
       ref - reference gene
       toi - target of interest
     </xs:documentation>
   </xs:annotation>
   <xs:restriction base="xs:string">
     <xs:enumeration value="ref"/>
     <xs:enumeration value="toi"/>
   </xs:restriction>
 </xs:simpleType>

 <xs:complexType name="temperatureType">
   <xs:annotation>
     <xs:documentation>
       This step keeps a constant temperature on the heat block.
     </xs:documentation>
   </xs:annotation>
   <xs:sequence>
     <xs:element name="temperature" type="xs:float">
       <xs:annotation>
         <xs:documentation>
           The temperature of the step in Celsius.
         </xs:documentation>
       </xs:annotation>
     </xs:element>
     <xs:element name="duration" type="xs:positiveInteger">
       <xs:annotation>
         <xs:documentation>
           The duration of this step in seconds.
         </xs:documentation>
       </xs:annotation>
     </xs:element>
     <xs:element name="temperatureChange" type="xs:float" minOccurs="0">
       <xs:annotation>
         <xs:documentation>
           The change of the temperature from one cycle to the next:
           actual temperature = temperature + (temperatureChange * cycle couter)
         </xs:documentation>
       </xs:annotation>
     </xs:element>
     <xs:element name="durationChange" type="xs:int" minOccurs="0">
       <xs:annotation>
         <xs:documentation>
           The change of the duration from one cycle to the next:
           actual duration = duration + (durationChange * cycle couter)
         </xs:documentation>
       </xs:annotation>
     </xs:element>
     <xs:element name="measure" type="rdml:measureType" minOccurs="0">
       <xs:annotation>
         <xs:documentation>
           Indicates to make a measurement and store it as meltcurve or realtime data.
         </xs:documentation>
       </xs:annotation>
     </xs:element>
     <xs:element name="ramp" type="xs:float" minOccurs="0">
       <xs:annotation>
         <xs:documentation>
           The allowed temperature change from one step to the next in
           Celsius per second. No value means maximal change rate.
         </xs:documentation>
       </xs:annotation>
     </xs:element>
   </xs:sequence>
 </xs:complexType>

 <xs:complexType name="templateQualityType">
   <xs:sequence>
     <xs:element name="method" type="xs:string">
       <xs:annotation>
         <xs:documentation>
           Method used to measure quality, for example "Spectroscopy, OD 260/280".
         </xs:documentation>
       </xs:annotation>
     </xs:element>
     <xs:element name="result" type="xs:float">
       <xs:annotation>
         <xs:documentation>
           The measured value.
         </xs:documentation>
       </xs:annotation>
     </xs:element>
   </xs:sequence>
 </xs:complexType>

 <xs:complexType name="thermalCyclingConditionsType">
   <xs:annotation>
     <xs:documentation>
       A cycling program for PCR or to amplify cDNA.
     </xs:documentation>
   </xs:annotation>
   <xs:sequence>
     <xs:element name="description" type="xs:string" minOccurs="0"/>
     <xs:element name="documentation" type="rdml:idReferencesType" minOccurs="0" maxOccurs="unbounded"/>
     <xs:element name="lidTemperature" type="xs:float" minOccurs="0">
       <xs:annotation>
         <xs:documentation>
           The temperature in Celsius the lid should keep during the cycling.
         </xs:documentation>
       </xs:annotation>
     </xs:element>
     <xs:element name="experimenter" type="rdml:idReferencesType" minOccurs="0" maxOccurs="unbounded">
       <xs:annotation>
         <xs:documentation>
           Reference to the person who made or uses this protocol.
         </xs:documentation>
       </xs:annotation>
     </xs:element>
     <xs:element name="step" type="rdml:stepType" maxOccurs="unbounded">
       <xs:annotation>
         <xs:documentation>
           The steps a protocol runs through to amplify DNA.
         </xs:documentation>
       </xs:annotation>
     </xs:element>
   </xs:sequence>
   <xs:attribute name="id" type="rdml:idType" use="required"/>
 </xs:complexType>

 <xs:complexType name="thirdPartyExtensionsType">
   <xs:annotation>
     <xs:documentation>
       This is the place to insert extensions not supported by RDML. Please use 
       a descriptive and unique root element to avoid interference with other 
       third party extensions.
     </xs:documentation>
   </xs:annotation>
   <xs:sequence>
     <xs:any maxOccurs="unbounded" minOccurs="0"/>
   </xs:sequence>
 </xs:complexType>

 <xs:complexType name="xRefType">
   <xs:sequence>
     <xs:element name="name" type="xs:string" minOccurs="0">
       <xs:annotation>
         <xs:documentation>
           Reference to an external database, for example "genebank".
         </xs:documentation>
       </xs:annotation>
     </xs:element>
     <xs:element name="id" type="xs:string" minOccurs="0">
       <xs:annotation>
         <xs:documentation>
           The ID of the entry within the external database, for example "AJ832138".
         </xs:documentation>
       </xs:annotation>
     </xs:element>
   </xs:sequence>
 </xs:complexType>

 <xs:element name="rdml">
   <xs:complexType>
     <xs:sequence>
       <xs:element name="dateMade" type="xs:dateTime" minOccurs="0">
         <xs:annotation>
           <xs:documentation>
             The timestamp of the creation of this file.
           </xs:documentation>
         </xs:annotation>
       </xs:element>
       <xs:element name="dateUpdated" type="xs:dateTime" minOccurs="0">
         <xs:annotation>
           <xs:documentation>
             The timestamp of the last update of this file.
           </xs:documentation>
         </xs:annotation>
       </xs:element>
       <xs:element name="id" type="rdml:rdmlIdType" maxOccurs="unbounded" minOccurs="0"/>
       <xs:element name="experimenter" type="rdml:experimenterType" maxOccurs="unbounded" minOccurs="0"/>
       <xs:element name="documentation" type="rdml:documentationType" maxOccurs="unbounded" minOccurs="0"/>
       <xs:element name="sample" type="rdml:sampleType" maxOccurs="unbounded" minOccurs="0">
         <xs:unique name="sampleXRefId">
           <xs:annotation>
             <xs:documentation>
               xRefs within the sample types must be unique.
             </xs:documentation>
           </xs:annotation>
           <xs:selector xpath="./rdml:xRef" />
           <xs:field xpath="rdml:id" />
           <xs:field xpath="rdml:name" />
         </xs:unique>
         <xs:unique name="sampleDocumentationId">
           <xs:annotation>
             <xs:documentation>
               Documentation references within the sample types must be unique.
             </xs:documentation>
           </xs:annotation>
           <xs:selector xpath="./rdml:documentation" />
           <xs:field xpath="@id" />
         </xs:unique>
       </xs:element>
       <xs:element name="target" type="rdml:targetType" maxOccurs="unbounded" minOccurs="0">
         <xs:unique name="targetXRefId">
           <xs:annotation>
             <xs:documentation>
               xRefs within the sample types must be unique.
             </xs:documentation>
           </xs:annotation>
           <xs:selector xpath="./rdml:xRef" />
           <xs:field xpath="rdml:id" />
           <xs:field xpath="rdml:name" />
         </xs:unique>
         <xs:unique name="targetDocumentationId">
           <xs:annotation>
             <xs:documentation>
               Documentation references within the target types must be unique.
             </xs:documentation>
           </xs:annotation>
           <xs:selector xpath="./rdml:documentation" />
           <xs:field xpath="@id" />
         </xs:unique>
       </xs:element>
       <xs:element name="thermalCyclingConditions" type="rdml:thermalCyclingConditionsType" maxOccurs="unbounded" minOccurs="0">
         <xs:unique name="thermalUniId">
           <xs:annotation>
             <xs:documentation>
               step nr within the thermalCyclingConditions must be unique.
             </xs:documentation>
           </xs:annotation>
           <xs:selector xpath="./rdml:step" />
           <xs:field xpath="rdml:nr" />
         </xs:unique>
         <xs:unique name="thermalCyclingConditionsDocumentationId">
           <xs:annotation>
             <xs:documentation>
               Documentation references within the thermalCyclingConditions types must be unique.
             </xs:documentation>
           </xs:annotation>
           <xs:selector xpath="./rdml:documentation" />
           <xs:field xpath="@id" />
         </xs:unique>
         <xs:unique name="thermalCyclingConditionsExperimenterId">
           <xs:annotation>
             <xs:documentation>
               Experimenter references within the thermalCyclingConditions types must be unique.
             </xs:documentation>
           </xs:annotation>
           <xs:selector xpath="./rdml:experimenter" />
           <xs:field xpath="@id" />
         </xs:unique>
       </xs:element>
       <xs:element name="experiment" type="rdml:experimentType" maxOccurs="unbounded" minOccurs="0">
         <xs:unique name="experimentUniId">
           <xs:annotation>
             <xs:documentation>
               run IDs within the experiment types must be unique.
             </xs:documentation>
           </xs:annotation>
           <xs:selector xpath="./rdml:run" />
           <xs:field xpath="@id" />
         </xs:unique>
         <xs:unique name="experimentDocumentationId">
           <xs:annotation>
             <xs:documentation>
               Documentation references within the experiment types must be unique.
             </xs:documentation>
           </xs:annotation>
           <xs:selector xpath="./rdml:documentation" />
           <xs:field xpath="@id" />
         </xs:unique>
      </xs:element>
      <xs:element name="thirdPartyExtensions" type="rdml:thirdPartyExtensionsType" minOccurs="0"/>
     </xs:sequence>
   <xs:attribute name="version" type="xs:string" fixed="1.0" use="required"/>
   </xs:complexType>
   
   <xs:keyref name="documentationKeyRef" refer="rdml:documentationKey">
     <xs:selector xpath="./rdml:sample/rdml:documentation" />
     <xs:field xpath="@id" />
   </xs:keyref>
   <xs:keyref name="documentationKeyRef2" refer="rdml:documentationKey">
     <xs:selector xpath="./rdml:target/rdml:documentation" />
     <xs:field xpath="@id" />
   </xs:keyref>
   <xs:keyref name="documentationKeyRef3" refer="rdml:documentationKey">
     <xs:selector xpath="./rdml:thermalCyclingConditions/rdml:documentation" />
     <xs:field xpath="@id" />
   </xs:keyref>
   <xs:keyref name="documentationKeyRef4" refer="rdml:documentationKey">
     <xs:selector xpath="./rdml:experiment/rdml:documentation" />
     <xs:field xpath="@id" />
   </xs:keyref>
   <xs:keyref name="documentationKeyRef5" refer="rdml:documentationKey">
     <xs:selector xpath="./rdml:experiment/rdml:run/rdml:documentation" />
     <xs:field xpath="@id" />
   </xs:keyref>
   <xs:key name="documentationKey">
     <xs:selector xpath="./rdml:documentation" />
     <xs:field xpath="@id" />
   </xs:key>

   <xs:key name="experimentIdKey">
     <xs:selector xpath="./rdml:experiment" />
     <xs:field xpath="@id" />
   </xs:key>

   <xs:keyref name="experimenterIdKeyRef" refer="rdml:experimenterIdKey">
     <xs:selector xpath="./rdml:experiment/rdml:run/rdml:experimenter" />
     <xs:field xpath="@id" />
   </xs:keyref>
   <xs:keyref name="experimenterIdKeyRef2" refer="rdml:experimenterIdKey">
     <xs:selector xpath="./rdml:thermalCyclingConditions/rdml:experimenter" />
     <xs:field xpath="@id" />
   </xs:keyref>
   <xs:key name="experimenterIdKey">
     <xs:selector xpath="./rdml:experimenter" />
     <xs:field xpath="@id" />
   </xs:key>

   <xs:keyref name="sampleIdKeyRef" refer="rdml:sampleIdKey">
     <xs:selector xpath="./rdml:experiment/rdml:run/rdml:react/rdml:sample" />
     <xs:field xpath="@id" />
   </xs:keyref>
   <xs:key name="sampleIdKey">
     <xs:selector xpath="./rdml:sample" />
     <xs:field xpath="@id" />
   </xs:key>
	 
   <xs:keyref name="targetIdKeyRef" refer="rdml:targetIdKey">
     <xs:selector xpath="./rdml:experiment/rdml:run/rdml:react/rdml:data/rdml:tar" />
     <xs:field xpath="@id" />
   </xs:keyref>
   <xs:key name="targetIdKey">
     <xs:selector xpath="./rdml:target" />
     <xs:field xpath="@id" />
   </xs:key>
	 
   <xs:keyref name="thermalCyclingConditionsIdKeyRef" refer="rdml:thermalCyclingConditionsIdKey">
     <xs:selector xpath="./rdml:experiment/rdml:run/rdml:thermalCyclingConditions" />
     <xs:field xpath="@id" />
   </xs:keyref>
   <xs:keyref name="thermalCyclingConditionsIdKeyRef2" refer="rdml:thermalCyclingConditionsIdKey">
     <xs:selector xpath="./rdml:sample/rdml:cdnaSynthesisMethod/rdml:thermalCyclingConditions" />
     <xs:field xpath="@id" />
   </xs:keyref>
   <xs:key name="thermalCyclingConditionsIdKey">
     <xs:selector xpath="./rdml:thermalCyclingConditions" />
     <xs:field xpath="@id" />
   </xs:key>
   </xs:element>
</xs:schema>
