.xsd

<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">

   <xsd:annotation>
      <xsd:documentation xml:lang="pl">
         XML Schema do pliku zamowienia.
      </xsd:documentation>
   </xsd:annotation>

   <xsd:element name="zamowienie" type="zamowienie_typ"/>

   <xsd:element name="komentarz" type="xsd:string"/>

   <xsd:complexType name="zamowienie_typ">
      <xsd:sequence>
         <xsd:element name="wyslac_do" type="adres_typ"/>
         <xsd:element name="rachunek" type="adres_typ"/>
         <xsd:element ref="komentarz" minOccurs="0"/>
         <xsd:element name="towary" type="towary_typ"/>
      </xsd:sequence>
      <xsd:attribute name="data" type="xsd:string"/>
   </xsd:complexType>

   <xsd:complexType name="adres_typ">
      <xsd:sequence>
         <xsd:element name="osoba" type="xsd:string"/>
         <xsd:element name="ulica" type="xsd:string"/>
         <xsd:element name="numer" type="xsd:string"/>
         <xsd:element name="kod_pocztowy" type="kod_pocztowy_typ"/>
         <xsd:element name="miasto" type="xsd:string"/>
         <xsd:element name="wojewodztwo" type="wojewodztwo_typ" minOccurs="0"/>
      </xsd:sequence>
      <xsd:attribute name="kraj" type="xsd:NMTOKEN" fixed="PL"/>
   </xsd:complexType>

   <xsd:complexType name="towary_typ">
      <xsd:sequence>
         <xsd:element name="towar" minOccurs="0" maxOccurs="unbounded">
         <xsd:complexType>
            <xsd:sequence>
               <xsd:element name="producent_towaru" type="xsd:string"/>
               <xsd:element name="nazwa_towaru" type="nazwa_towaru_typ"/>
               <xsd:element name="ilosc" type="xsd:decimal"/>
               <xsd:element name="cena_jednostkowa" type="cena_typ"/>
               <xsd:element name="data_realizacji" type="xsd:string" minOccurs="0"/>
            </xsd:sequence>
         <xsd:attribute name="kod_produktu" type="kod_produktu_typ"/>
         </xsd:complexType>
         </xsd:element>
      </xsd:sequence>
   </xsd:complexType>

   <xsd:simpleType name="kod_produktu_typ">
      <xsd:restriction base="xsd:string">
         <xsd:pattern value="[A-Z][A-Z][A-Z]-\d{3}-\d{2}"/>
      </xsd:restriction>
   </xsd:simpleType>

   <xsd:simpleType name="kod_pocztowy_typ">
      <xsd:restriction base="xsd:string">
         <xsd:pattern value="\d{2}-\d{3}"/>
      </xsd:restriction>
   </xsd:simpleType>

   <xsd:simpleType name="cena_typ">
      <xsd:restriction base="xsd:decimal">
         <xsd:minInclusive value="0"/>
         <xsd:maxInclusive value="10000"/>
      </xsd:restriction>
   </xsd:simpleType>

   <xsd:simpleType name="nazwa_towaru_typ">
     <xsd:restriction base="xsd:string">
        <xsd:minLength value="3"/>
        <xsd:maxLength value="30"/>
     </xsd:restriction>
   </xsd:simpleType>

   <xsd:simpleType name="wojewodztwo_typ">
      <xsd:restriction base="xsd:string">
        <xsd:enumeration value="Zachodnio-pomorskie"/>
        <xsd:enumeration value="Pomorskie"/>
        <xsd:enumeration value="Warminsko-mazurskie"/>
        <xsd:enumeration value="Podlaskie"/>
        <xsd:enumeration value="Mazowieckie"/>
        <xsd:enumeration value="Kujawsko-pomorskie"/>
        <xsd:enumeration value="Wielkopolskie"/>
        <xsd:enumeration value="Lubuskie"/>
        <xsd:enumeration value="Dolnoslaskie"/>
        <xsd:enumeration value="Opolskie"/>
        <xsd:enumeration value="Lodzkie"/>
        <xsd:enumeration value="Slaskie"/>
        <xsd:enumeration value="Malopolskie"/>
        <xsd:enumeration value="Swietokrzyskie"/>
        <xsd:enumeration value="Lubelskie"/>
        <xsd:enumeration value="Podkarpackie"/>
      </xsd:restriction>
   </xsd:simpleType>

</xsd:schema>