1<?xml version="1.0" encoding="UTF-8"?>
  2<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  3  <xs:import namespace="http://www.w3.org/2001/XMLSchema-instance" schemaLocation="xsi.xsd"/>
  4  <xs:element name="calibrations">
  5    <xs:complexType>
  6      <xs:choice minOccurs="0" maxOccurs="unbounded">
  7        <xs:element ref="source"/>
  8        <xs:element ref="calibration"/>
  9      </xs:choice>
 10      <xs:attribute ref="xsi:noNamespaceSchemaLocation" use="required"/>
 11    </xs:complexType>
 12  </xs:element>
 13  <xs:element name="source">
 14    <xs:annotation>
 15      <xs:documentation>Identify all spacecraft this file applies to. Wildcards allowed.</xs:documentation>
 16    </xs:annotation>
 17    <xs:complexType>
 18      <xs:sequence>
 19        <xs:element ref="scid"/>
 20      </xs:sequence>
 21    </xs:complexType>
 22  </xs:element>
 23  <xs:element name="scid" type="xs:string"/>
 24  <xs:element name="calibration">
 25    <xs:annotation>
 26      <xs:documentation>A single named calibration function</xs:documentation>
 27    </xs:annotation>
 28    <xs:complexType>
 29      <xs:choice minOccurs="0" maxOccurs="unbounded">
 30        <xs:element ref="field"/>
 31        <xs:choice>
 32          <xs:annotation>
 33            <xs:documentation>State a linear calibration.</xs:documentation>
 34          </xs:annotation>
 35          <xs:element ref="linear"/>
 36          <xs:element ref="poly"/>
 37          <xs:element ref="plsql"/>
 38          <xs:element ref="sql"/>
 39        </xs:choice>
 40      </xs:choice>
 41    </xs:complexType>
 42  </xs:element>
 43  <xs:element name="field" type="xs:string">
 44    <xs:annotation>
 45      <xs:documentation>Name of the calibration function as refered from the raw table field definition.</xs:documentation>
 46    </xs:annotation>
 47  </xs:element>
 48  <xs:element name="linear">
 49    <xs:complexType>
 50      <xs:sequence>
 51        <xs:element maxOccurs="unbounded" ref="pair"/>
 52      </xs:sequence>
 53    </xs:complexType>
 54  </xs:element>
 55  <xs:element name="pair">
 56    <xs:annotation>
 57      <xs:documentation>A linear calibraton may contain multiple pairs.</xs:documentation>
 58    </xs:annotation>
 59    <xs:complexType>
 60      <xs:all>
 61        <xs:element ref="raw"/>
 62        <xs:element ref="cal"/>
 63      </xs:all>
 64    </xs:complexType>
 65  </xs:element>
 66  <xs:element name="raw" type="xs:integer">
 67    <xs:annotation>
 68      <xs:documentation>Each pair has a raw value</xs:documentation>
 69    </xs:annotation>
 70  </xs:element>
 71  <xs:element name="cal" type="xs:double">
 72    <xs:annotation>
 73      <xs:documentation>Each pair has a calibrated value</xs:documentation>
 74    </xs:annotation>
 75  </xs:element>
 76  <xs:element name="poly">
 77    <xs:annotation>
 78      <xs:documentation>State a polynomial calibration</xs:documentation>
 79    </xs:annotation>
 80    <xs:complexType>
 81      <xs:sequence>
 82        <xs:element maxOccurs="unbounded" ref="coeff"/>
 83      </xs:sequence>
 84    </xs:complexType>
 85  </xs:element>
 86  <xs:element name="coeff" type="xs:double">
 87    <xs:annotation>
 88      <xs:documentation>A polynomial may have multiple terms. x0 first.</xs:documentation>
 89    </xs:annotation>
 90  </xs:element>
 91  <xs:element name="plsql" type="xs:string">
 92    <xs:annotation>
 93      <xs:documentation>Use a named pl/SQL function for calibration.</xs:documentation>
 94    </xs:annotation>
 95  </xs:element>
 96  <xs:element name="sql" type="xs:string">
 97    <xs:annotation>
 98      <xs:documentation>Use an inline SQL statement.</xs:documentation>
 99    </xs:annotation>
100  </xs:element>
101</xs:schema>