<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="/xs3p.xsl"?>
<xs:schema version="2008.1"
 xmlns:xs="http://www.w3.org/2001/XMLSchema"
 targetNamespace="http://www.thrustcurve.org/2008/SearchResponse"
 xmlns="http://www.thrustcurve.org/2008/SearchResponse"
 elementFormDefault="qualified">
  <xs:annotation>
    <xs:documentation xml:lang="en">
      This schema defines the response returned by the ThrustCurve.org search XML API.
      For more information, see the documentation at http://www.thrustcurve.org/searchapi.shtml
    </xs:documentation>
  </xs:annotation>

  <xs:element name="search-response">
    <xs:complexType>
      <xs:sequence>

        <!-- the search criteria are returned, along with the number of matches -->
	<xs:element name="criteria">
          <xs:complexType>
            <xs:sequence>
	      <xs:element name="criterion" minOccurs="0" maxOccurs="unbounded">
                <xs:complexType>
                  <xs:sequence>
                    <xs:element name="name" type="xs:string"/>
                    <xs:element name="value" type="xs:string"/>
                    <xs:element name="matches" type="xs:integer"/>
                    <xs:element name="error" type="xs:string" minOccurs="0"/>
                  </xs:sequence>
                </xs:complexType>
	      </xs:element>
              <xs:element name="matches" type="xs:integer"/>
            </xs:sequence>
          </xs:complexType>
	</xs:element>

        <!-- the list of results is always present, but may be empty -->
	<xs:element name="results">
          <xs:complexType>
            <xs:sequence>
	      <xs:element name="result" minOccurs="0" maxOccurs="unbounded">
                <xs:complexType>
                  <xs:sequence>
                    <xs:element name="motor-id" type="xs:integer"/>
	            <xs:element name="manufacturer" type="xs:string"/>
	            <xs:element name="designation" type="xs:string"/>
	            <xs:element name="brand-name" type="xs:string"/>
	            <xs:element name="common-name" type="xs:string"/>
	            <xs:element name="impulse-class" type="xs:string"/>
                    <xs:element name="diameter" type="xs:decimal"/>
                    <xs:element name="type" type="xs:string"/>
	            <xs:element name="cert-org" type="xs:string"/>
                    <xs:element name="avg-thrust-n" type="xs:decimal" minOccurs="0"/>
                    <xs:element name="max-thrust-n" type="xs:decimal" minOccurs="0"/>
                    <xs:element name="tot-impulse-ns" type="xs:decimal" minOccurs="0"/>
                    <xs:element name="burn-time-s" type="xs:decimal" minOccurs="0"/>
                    <xs:element name="data-files" type="xs:integer"/>
                    <xs:element name="info-url" type="xs:anyURI"/>
                  </xs:sequence>
                </xs:complexType>
	      </xs:element>
            </xs:sequence>
          </xs:complexType>
	</xs:element>

        <!-- if a general error occurred more detail is returned -->
	<xs:element name="error" type="xs:string" minOccurs="0"/>
      </xs:sequence>
    </xs:complexType>
  </xs:element>

</xs:schema>
