<?xml version="1.0"?>
<schema targetNamespace="http://ws.infotorg.no/xml/PostenNorge/Adresseregisteret/2006-10-07/Adresseregisteret.xsd"
    xmlns:tns="http://ws.infotorg.no/xml/PostenNorge/Adresseregisteret/2006-10-07/Adresseregisteret.xsd"
    xmlns="http://www.w3.org/2001/XMLSchema">

    <annotation>
        <documentation xml:lang="no">
            Datatyper for Postens adresseregister.

            © 2006 ErgoGroup AS
            Forfatter: Dag Lem &lt;dag@nimrod.no&gt;
        </documentation>
    </annotation>

    <group name="husnr">
        <sequence>
            <element name="husnr" type="string" minOccurs="0"/>
            <element name="undernr" type="string" minOccurs="0"/>
        </sequence>
    </group>

    <group name="gatesoek">
        <sequence>
            <choice>
                <element name="gatekode" type="string"/>
                <element name="gatenavn" type="string"/>
            </choice>
            <group ref="tns:husnr"/>
        </sequence>
    </group>

    <element name="hentAdressesoek">
        <complexType>
            <choice>
                <sequence>
                    <element name="kommunenr" type="string"/>
                    <element name="postnr" type="string" minOccurs="0"/>
                    <group ref="tns:gatesoek" minOccurs="0"/>
                </sequence>
                <sequence>
                    <element name="postnr" type="string"/>
                    <group ref="tns:gatesoek" minOccurs="0"/>
                </sequence>
                <sequence>
                    <element name="gatenavn" type="string"/>
                    <group ref="tns:husnr"/>
                </sequence>
            </choice>
        </complexType>
    </element>

    <complexType name="status">
        <sequence>
            <element name="hovedstatus" type="string"/>
            <element name="statuskode" type="string"/>
            <element name="statusmelding" type="string"/>
        </sequence>
    </complexType>

    <complexType name="gater">
        <simpleContent>
            <extension base="string">
                <attribute name="knr" type="string" use="required"/>
                <attribute name="navn" type="string" use="required"/>
                <attribute name="gnr" type="string" use="required"/>
            </extension>
        </simpleContent>
    </complexType>

    <group name="gate">
        <sequence>
            <element name="knr" type="string"/>
            <element name="gnr" type="string"/>
            <element name="navn" type="string"/>
            <element name="postnr" type="string" minOccurs="0"/>
            <element name="gate" minOccurs="0" maxOccurs="unbounded">
                <complexType>
                    <simpleContent>
                        <extension base="string">
                            <attribute name="postnr" type="string"/>
                            <attribute name="nr" type="string" use="required"/>
                        </extension>
                    </simpleContent>
                </complexType>
            </element>
        </sequence>
    </group>

    <element name="Adressesoek">
        <complexType>
            <sequence>
                <element name="status" type="tns:status"/>
                <choice>
                    <element name="gater" type="tns:gater" minOccurs="0" maxOccurs="unbounded"/>
                    <group ref="tns:gate"/>
                </choice>
            </sequence>
        </complexType>
    </element>

</schema>
