<?xml version="1.0" encoding="utf-8"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
  targetNamespace="http://www.gophernet.org/schemata/address.xsd"
  xmlns="http://www.gophernet.org/schemata/address.xsd"
  elementFormDefault="qualified">

  <xsd:annotation>
    <xsd:documentation>
      An address document is a simple description of a single mailing address.
      Address element are meant more to be used as something to imbed in
      another document rather than as standalone documents themselves.

      Although different countries use widely differing formats for specifying
      addresses, most of the data for any country can be stuffed into two lines
      of generic address information, a city, a state, and a postal code.  Four
      lines is enough to fill out an Fedex international airbill, and such a
      format is what is used here.  If you need a more complete and granular
      address format, you may wish to look at something like the IDEAlliance
      Address Data Interchange Specification (http://www.idealliance.org/adis/).
    </xsd:documentation>
  </xsd:annotation>

  <xsd:complexType name="address">
    <xsd:annotation>
      <xsd:documentation>
        Every element in the address is optional for maximum flexibility.  The
        elements to include for an address to make sense will vary by country.
      </xsd:documentation>
    </xsd:annotation>

    <xsd:sequence>
      <xsd:element name="recipient" type="xsd:string" minOccurs="0" maxOccurs="1">
        <xsd:annotation>
          <xsd:documentation>
            The most specific part of the address.  This is usually the name of
            a person or department.
          </xsd:documentation>
        </xsd:annotation>
      </xsd:element>

      <xsd:element name="address1" type="xsd:string" minOccurs="0" maxOccurs="1">
        <xsd:annotation>
          <xsd:documentation>
            The first generic address line.  This line usually contains a street
            name and number.
          </xsd:documentation>
        </xsd:annotation>
      </xsd:element>

      <xsd:element name="address2" type="xsd:string" minOccurs="0" maxOccurs="1">
        <xsd:annotation>
          <xsd:documentation>
            The second generic address line, providing data to augment address1.
            This line may contain information such as suite or building numbers.
          </xsd:documentation>
        </xsd:annotation>
      </xsd:element>

      <xsd:element name="city" type="xsd:string" minOccurs="0" maxOccurs="1">
        <xsd:annotation>
          <xsd:documentation>
            The name of the city or town.
          </xsd:documentation>
        </xsd:annotation>
      </xsd:element>

      <xsd:element name="state" type="xsd:string" minOccurs="0" maxOccurs="1">
        <xsd:annotation>
          <xsd:documentation>
            The name or abbreviation of the state or province.  I call it only
            "state" for brevity, not as an insult to Canadians.
          </xsd:documentation>
        </xsd:annotation>
      </xsd:element>

      <xsd:element name="postalCode" type="xsd:string" minOccurs="0" maxOccurs="1">
        <xsd:annotation>
          <xsd:documentation>
            A postal code, such as a US ZIP code.
          </xsd:documentation>
        </xsd:annotation>
      </xsd:element>

      <xsd:element name="country" type="xsd:string" minOccurs="0" maxOccurs="1">
        <xsd:annotation>
          <xsd:documentation>
            The name of the country.
          </xsd:documentation>
        </xsd:annotation>
      </xsd:element>
    </xsd:sequence>
    <xsd:attribute name="id" type="xsd:ID" use="optional">
      <xsd:annotation>
        <xsd:documentation>
          An optional ID attribute.
        </xsd:documentation>
      </xsd:annotation>
    </xsd:attribute>
  </xsd:complexType>

  <xsd:element name="address" type="address">
    <xsd:annotation>
      <xsd:documentation>
        An implementation of the address type as the element "address".
      </xsd:documentation>
    </xsd:annotation>
  </xsd:element>
</xsd:schema>

