<?xml version="1.0" encoding="UTF-8"?>
<!--DOCTYPE schema PUBLIC "-//W3C/DTD XML Schema Version 1.0//EN"
                        "http://www.w3.org/TR/2000/WD-xmlschema-1-20000225/structures.dtd"-->
<!DOCTYPE schema [
<!ENTITY app-types SYSTEM "src/examples/oes/schema/app-types.ent">
<!ENTITY global-codes SYSTEM "src/examples/oes/schema/global-codes.ent">
]>

<!-- Schema for Order Entry System import -->
<xsd:schema xmlns:xsd="http://www.w3.org/1999/XMLSchema"
            targetNamespace="http://castor.exolab.org/OES"
            version="0.1">

&app-types;
&global-codes;

  <!-- PurchaseOrder -->
  <xsd:element name="PurchaseOrder">
    <xsd:type content="elemOnly" order="seq">

      <xsd:element name="orderStatus" type="orderStatusCode" minOccurs="1" maxOccurs="1" />

      <xsd:element name="comment" type="string" minOccurs="0" maxOccurs="1" />
      <xsd:element name="quoteId" type="string" minOccurs="0" maxOccurs="1" />
      <xsd:element name="packing" type="string" minOccurs="0" maxOccurs="1" />
      <xsd:element name="deliveryTo" type="string" minOccurs="1" maxOccurs="1" />
      <xsd:element name="shipmentTerms" type="shipmentTermsCode" minOccurs="1" maxOccurs="1" />

      <!-- PurchaseOrder.LineItem -->
      <xsd:element name="LineItem" minOccurs="0">
        <xsd:type content="elemOnly" order="seq">

          <xsd:element name="sku" type="skuRef" minOccurs="1" maxOccurs="1">
            <xsd:annotation>
            <xsd:info>Product identifier (SKU)</xsd:info>
            </xsd:annotation>
          </xsd:element>

          <xsd:element name="quantity" type="integer" minOccurs="1" maxOccurs="1">
            <xsd:annotation>
              <xsd:info>Quantity of item (integer)</xsd:info>
            </xsd:annotation>
          </xsd:element>

          <!-- PurchaseOrder.LineItem.Price -->
          <xsd:element name="Price" minOccurs="1" maxOccurs="1">
            <xsd:annotation>
              <xsd:info>Requested price</xsd:info>
            </xsd:annotation>

            <xsd:type content="elemOnly" order="seq">
              <xsd:element name="amount" type="double" minOccurs="1" maxOccurs="1">
              <xsd:annotation>
                <xsd:info>Financial amout)</xsd:info>
              </xsd:annotation>
              </xsd:element>
        
              <xsd:attribute name="currency" type="correncyCode" minOccurs="1">
                <xsd:annotation>
                  <xsd:info>Currency type</xsd:info>
                </xsd:annotation>
              </xsd:attribute>

            </xsd:type>
          </xsd:element>
          <!-- /Price -->

          <xsd:element name="shipDate" type="timeInstant" minOccurs="0" maxOccurs="1">
            <xsd:annotation>
              <xsd:info>Ship date (if different than rest of order)</xsd:info>
            </xsd:annotation>
          </xsd:element>

          <xsd:element name="contractId" type="string" minOccurs="0" maxOccurs="1">
            <xsd:annotation>
              <xsd:info>Contract governing order (optional)</xsd:info>
           </xsd:annotation>
         </xsd:element>

          <xsd:element name="handling" type="string" minOccurs="0" maxOccurs="1">
            <xsd:annotation>
              <xsd:info>Special handling instructions (optional)</xsd:info>
            </xsd:annotation>
          </xsd:element>

          <xsd:attribute name="lineNumber" type="integer" minOccurs="1">
            <xsd:annotation>
              <xsd:info>The line number is unique and serial within an order and base one</xsd:info>
            </xsd:annotation>
          </xsd:attribute>

        </xsd:type>
      </xsd:element>
      <!-- /LineItem -->

      <xsd:attribute name="orderId" type="orderId" minOccurs="1" />

    </xsd:type>
  </xsd:element>
  <!-- /PurchaseOrder -->

</xsd:schema>








