<?xml version="1.0" encoding="utf-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" attributeFormDefault="unqualified" elementFormDefault="qualified">
  <!--definicje typow-->
  <!--wojewodztwo-->
  <xs:simpleType name="typwoj">
    <xs:restriction base="xs:string">
      <xs:pattern value="02|04|06|08|10|12|14|16|18|20|22|24|26|28|30|32"/>
    </xs:restriction>
  </xs:simpleType>
  <!-- powiat-->
  <xs:simpleType name="typpowiat">
    <xs:restriction base="xs:string">
      <xs:maxLength value="2"/>
      <xs:pattern value="[0-9]{2}"/>
    </xs:restriction>
  </xs:simpleType>
  <!--gmina-->
  <xs:simpleType name="typgmi">
    <xs:restriction base="xs:string">
      <xs:pattern value="[0-9]{2}"/>
    </xs:restriction>
  </xs:simpleType>
  <!-- rodzaj -->
  <xs:simpleType name="typrodz">
    <xs:restriction base="xs:string">
      <xs:enumeration value="1"/>
      <xs:enumeration value="2"/>
      <xs:enumeration value="4"/>
      <xs:enumeration value="5"/>
      <xs:enumeration value="8"/>
      <xs:enumeration value="9"/>
    </xs:restriction>
  </xs:simpleType>
  <!--plec-->
  <xs:simpleType name="typplec">
    <xs:restriction base="xs:integer">
      <xs:minInclusive value="1"/>
      <xs:maxInclusive value="2"/>
    </xs:restriction>
  </xs:simpleType>
  
  <!-- typ cztery -->
  <xs:simpleType name="typfour">
    <xs:restriction base="xs:integer">
      <xs:minInclusive value="0"/>
      <xs:maxInclusive value="9999"/>
    </xs:restriction>
  </xs:simpleType>
  <!-- typ six -->
  <xs:simpleType name="typsix">
    <xs:restriction base="xs:integer">
      <xs:minInclusive value="0"/>
      <xs:maxInclusive value="999999"/>
    </xs:restriction>
  </xs:simpleType>
  <!-- typ nazwa -->
  <xs:simpleType name="typnazwa">
    <xs:restriction base="xs:string">
      <xs:maxLength value="128"/>
      </xs:restriction>
  </xs:simpleType>
  <xs:element name="dw1">
	  <xs:annotation>
		  <xs:documentation>zbiór danych dot. DW-1</xs:documentation>
	  </xs:annotation>
    <xs:complexType>
      <xs:sequence>
        <xs:element maxOccurs="1" name="row">
			<xs:annotation>
				<xs:documentation>pojedynczy wiersz danych DW-1</xs:documentation>
			</xs:annotation>
          <xs:complexType>
            <xs:sequence>
				<xs:element name="woj" type="typwoj">
					<xs:annotation>
						<xs:documentation>dwuznakowy symbol województwa zgodny z wykazem symboli terytorialnych GUS</xs:documentation>
					</xs:annotation>				
				</xs:element>
				<xs:element name="powiat" type="typpowiat">
					<xs:annotation>
						<xs:documentation>dwuznakowy symbol powiatu zgodny z wykazem symboli terytorialnych GUS</xs:documentation>
					</xs:annotation>
				</xs:element>
				<xs:element name="gmi" type="typgmi">
					<xs:annotation>
						<xs:documentation>dwuznakowy symbol gminy składającej sprawozdanie zgodny z wykazem symboli terytorialnych GUS</xs:documentation>
					</xs:annotation>
				</xs:element>
				<xs:element name="rodz" type="typrodz">
					<xs:annotation>
						<xs:documentation>jednoznakowy symbol rodzaju gminy składającej sprawozdanie zgodny z wykazem symboli terytorialnych GUS</xs:documentation>
					</xs:annotation>
				</xs:element>
				<xs:element name="typg" type="typplec">
					<xs:annotation>
						<xs:documentation>typ gminy składającej sprawozdanie (1-gmina miejska/2-gmina wiejska/)</xs:documentation>
					</xs:annotation>
				</xs:element>
				<xs:element name="d1w1" type="typfour">
					<xs:annotation>
						<xs:documentation>liczba wypełnionych formularzy D-W2 [zaokrąglona do góry (liczba osób z wypełnionych formularzy D-W2)/20]</xs:documentation>
					</xs:annotation>
				</xs:element>
				<xs:element name="d1w2" type="typsix">
					<xs:annotation>
						<xs:documentation>liczba osób z wypełnionych formularzy D-W2</xs:documentation>
					</xs:annotation>
				</xs:element>
				<xs:element name="d1w3" type="typsix">
					<xs:annotation>
						<xs:documentation>liczba mężczyzn z wypełnionych formularzy D-W2</xs:documentation>
					</xs:annotation>
				</xs:element>
				<xs:element name="d1w4" type="typsix">
					<xs:annotation>
						<xs:documentation>liczba kobiet z wypełnionych formularzy D-W2</xs:documentation>
					</xs:annotation>
				</xs:element>
				<xs:element name="d1w5" type="typsix">
					<xs:annotation>
						<xs:documentation>liczba osób przybyłych z zagranicy z wypełnionych formularzy D-W2</xs:documentation>
					</xs:annotation>
				</xs:element>
				<xs:element name="d1w6" type="typsix">
					<xs:annotation>
						<xs:documentation>liczba mężczyzn przybyłych z zagranicy z wypełnionych formularzy D-W2</xs:documentation>
					</xs:annotation>
				</xs:element>
				<xs:element name="d1w7" type="typsix">
					<xs:annotation>
						<xs:documentation>liczba kobiet przybyłych z zagranicy z wypełnionych formularzy D-W2</xs:documentation>
					</xs:annotation>
				</xs:element>
				<xs:element name="d1w8" type="typfour">
					<xs:annotation>
						<xs:documentation>liczba wypełnionych formularzy D-W3 [zaokrąglona do góry (liczba osób z wypełnionych formularzy D-W3)/20]</xs:documentation>
					</xs:annotation>
				</xs:element>
				<xs:element name="d1w9" type="typsix">
					<xs:annotation>
						<xs:documentation>liczba osób z wypełnionych formularzy D-W3</xs:documentation>
					</xs:annotation>
				</xs:element>
				<xs:element name="d1w10" type="typsix">
					<xs:annotation>
						<xs:documentation>liczba mężczyzn z wypełnionych formularzy D-W3</xs:documentation>
					</xs:annotation>
				</xs:element>
				<xs:element name="d1w11" type="typsix">
					<xs:annotation>
						<xs:documentation>liczba kobiet z wypełnionych formularzy D-W3</xs:documentation>
					</xs:annotation>
				</xs:element>
				<xs:element name="nazwa" type="typnazwa">
					<xs:annotation>
						<xs:documentation>pole (długość do 128 znaków) złożone z informacji o nazwie gminy; imieniu z nazwiskiem sporządzającego; telefonem kontaktowym; adresie e-mail (informacje rozdzielone średnikami)</xs:documentation>
					</xs:annotation>
				</xs:element>
            </xs:sequence>
          </xs:complexType>
        </xs:element>
      </xs:sequence>
    </xs:complexType>
  </xs:element>
</xs:schema>
