<?xml version="1.0" encoding="UTF-8"?>
<!--
 A Parts Delivery Message for SpecjAppServer Supplier & Buyer communication.
-->
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
    xmlns="org:spec:jent:ws:buyer:SupplierDeliveryMessage"
    xmlns:xmime="http://www.w3.org/2005/05/xmlmime" 
    xmlns:xs="http://www.w3.org/2001/XMLSchema" 
    xmlns:specwssdm="org:spec:jent:ws:buyer:SupplierDeliveryMessage"
    xmlns:ubli="urn:oasis:names:specification:ubl:schema:xsd:Invoice-1.0"
    targetNamespace="org:spec:jent:ws:buyer:SupplierDeliveryMessage"
    elementFormDefault="qualified"
    attributeFormDefault="unqualified"
    version="1.0">

  <xsd:import namespace="urn:oasis:names:specification:ubl:schema:xsd:Invoice-1.0" schemaLocation="UBL-Invoice-1.0.xsd"/>

  <xsd:element name="DeliveryMessage" type="specwssdm:DeliveryMessageType"/>
  <xsd:complexType name="DeliveryMessageType">
	<xsd:sequence>
        <xsd:element name="poNumber" type="xsd:int" />
        <xsd:element name="siteID" type="xsd:string" />
        <xsd:element name="numLines" type="xsd:int" />
	  <xsd:element name="invLines" type="specwssdm:DeliveryLineType" minOccurs="1" maxOccurs="unbounded"/>
	</xsd:sequence>
  </xsd:complexType>
  <xsd:complexType name="DeliveryLineType">
	<xsd:sequence>
        <xsd:element name="lineNumber" type="xsd:int" />
        <xsd:element name="partID" type="xsd:string" />
        <xsd:element name="quantity" type="xsd:int" />
        <xsd:element name="location" type="xsd:int" />
	</xsd:sequence>
  </xsd:complexType>

  <xsd:element name="InlineDeliveryMessage" type="InlineDeliveryMessageType"/>
  <xsd:complexType name="InlineDeliveryMessageType">
  <xsd:sequence>
      <xsd:element name="invoice" type="ubli:InvoiceType"/>
      <xsd:element name="deliveryMessage" type="specwssdm:DeliveryMessageType"/>
      </xsd:sequence>
  </xsd:complexType >

  <xsd:element name="DeliveryMessageAttach" type="DeliveryMessageAttachType"/>
  <xsd:complexType name="DeliveryMessageAttachType">
  <xsd:sequence>
      <xsd:element name="invoice" type="specwssdm:ListInvoiceAttachmentType"/>
      <xsd:element name="attachmentSize" type="xsd:int"/>
      <xsd:element name="deliveryMessage" type="specwssdm:DeliveryMessageType"/>
  </xsd:sequence>
  </xsd:complexType>

  <xsd:complexType name="ListInvoiceAttachmentType">
  <xsd:sequence>
      <xsd:element name="InvoiceAttachment" type="xsd:base64Binary" xmime:expectedContentTypes="application/octet-stream" minOccurs="1" maxOccurs="unbounded"/>
  </xsd:sequence>
  </xsd:complexType>

</xsd:schema>