<?xml version="1.0" encoding="utf-8"?>

<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" version="2.01">

  <xsd:annotation>
    <xsd:documentation xml:lang="en">
      International Aid Transparency Initiative: Organisation-Information Schema

      Release 2.01, 2014-10-21

      NOTE: the xml.xsd and iati-common.xsd schemas must be in the
      same directory as this one.

      This W3C XML Schema defines an XML document type for information
      about an aid organisation, following the standard published at
      http://iatistandard.org

      This document type may be extended with additional elements and
      attributes, but they must belong to an explicit XML namespace.
    </xsd:documentation>
  </xsd:annotation>

  <xsd:include schemaLocation="iati-common.xsd"/>

  <xsd:import namespace="http://www.w3.org/XML/1998/namespace"
              schemaLocation="xml.xsd"/>

  <xsd:element name="iati-organisations">
    <xsd:annotation>
      <xsd:documentation xml:lang="en">
        Top-level list of one or more IATI organisation records.
      </xsd:documentation>
    </xsd:annotation>
    <xsd:complexType>
      <xsd:sequence>
        <xsd:element ref="iati-organisation" minOccurs="1" maxOccurs="unbounded"/>
        <xsd:any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
      </xsd:sequence>
      <xsd:attribute name="version" type="xsd:string" use="required">
        <xsd:annotation>
          <xsd:documentation xml:lang="en">
            A number indicating the IATI specification version in use.
            This is mandatory and must be a valid version.
          </xsd:documentation>
        </xsd:annotation>
      </xsd:attribute>
      <xsd:attribute name="generated-datetime" type="xsd:dateTime" use="optional">
        <xsd:annotation>
          <xsd:documentation xml:lang="en">
            A date/time stamp for when this file was generated. This
            is not necessarily the last-updated date for the
            individual activity records in it. Use of this attribute
            is highly recommended, to allow recipients to know when a
            file has been updated.
          </xsd:documentation>
        </xsd:annotation>
      </xsd:attribute>
      <xsd:anyAttribute processContents="lax" namespace="##other"/>
    </xsd:complexType>
  </xsd:element>

  <xsd:element name="iati-organisation">
    <xsd:annotation>
      <xsd:documentation xml:lang="en">
        Top-level element for a single IATI organisation report.
      </xsd:documentation>
    </xsd:annotation>
    <xsd:complexType>
      <xsd:sequence>
        <xsd:element name="organisation-identifier" minOccurs="1" maxOccurs="1">
          <xsd:annotation>
            <xsd:documentation xml:lang="en">
              Machine-readable identification string for the
              organisation issuing the report. Must be in the format
              {RegistrationAgency}-{RegistrationNumber} where
              {RegistrationAgency} is a valid code in the
              RegistrationAgency code list and {RegistrationNumber }
              is a valid identifier issued by the {RegistrationAgency}
            </xsd:documentation>
          </xsd:annotation>
        </xsd:element>
        <xsd:element ref="name" minOccurs="1" maxOccurs="1"/>
        <xsd:element ref="reporting-org" minOccurs="1" maxOccurs="1"/>
        <xsd:element ref="total-budget" minOccurs="0" maxOccurs="unbounded"/>
        <xsd:element ref="recipient-org-budget" minOccurs="0" maxOccurs="unbounded"/>
        <xsd:element ref="recipient-country-budget" minOccurs="0" maxOccurs="unbounded"/>
        <xsd:element ref="document-link" minOccurs="0" maxOccurs="unbounded"/>
        <xsd:any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
      </xsd:sequence>
      <xsd:attribute name="last-updated-datetime" type="xsd:dateTime" use="optional">
        <xsd:annotation>
          <xsd:documentation xml:lang="en">
            The last date/time that the data for this specific
            organisation was updated.  This date must change whenever
            the value of any field changes.
          </xsd:documentation>
        </xsd:annotation>
      </xsd:attribute>
      <xsd:attribute ref="xml:lang">
        <xsd:annotation>
          <xsd:documentation xml:lang="en">
            ISO 639-1 code specifying the default language used in
            narrative elements throughout the activity. If this is not
            declared then the xml:lang attribute MUST be specified for
            each narrative element.
          </xsd:documentation>
        </xsd:annotation>
      </xsd:attribute>
      <xsd:attribute name="default-currency" type="xsd:string" use="optional">
        <xsd:annotation>
          <xsd:documentation xml:lang="en">
            Default ISO 4217 currency code for all financial values in
            this activity report. If this is not declared then the
            currency attribute MUST be specified for all monetary
            values.
          </xsd:documentation>
        </xsd:annotation>
      </xsd:attribute>
      <xsd:anyAttribute processContents="lax" namespace="##other"/>
    </xsd:complexType>
  </xsd:element>

  <xsd:element name="name">
    <xsd:annotation>
      <xsd:documentation xml:lang="en">
        The human-readable name of the organisation.
      </xsd:documentation>
    </xsd:annotation>
    <xsd:complexType>
      <xsd:sequence>
        <xsd:element ref="narrative" minOccurs="1" maxOccurs="unbounded" />
        <xsd:any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
      </xsd:sequence>
      <xsd:anyAttribute processContents="lax" namespace="##other"/>
    </xsd:complexType>
  </xsd:element>

  <xsd:element name="total-budget">
    <xsd:annotation>
      <xsd:documentation xml:lang="en">
        The total-budget element allows for the reporting of the organisation's 
        own budget. The recommendation is that, where and when possible, the 
        organisation's total annual planned budget for each of the next three 
        years is reported.
      </xsd:documentation>
    </xsd:annotation>
    <xsd:complexType>
      <xsd:sequence>
        <xsd:element name="period-start" minOccurs="1" maxOccurs="1">
          <xsd:annotation>
            <xsd:documentation xml:lang="en">
              The start of the budget period.
            </xsd:documentation>
          </xsd:annotation>
          <xsd:complexType>
            <xsd:sequence>
              <xsd:any processContents="lax" namespace="##other" minOccurs="0" maxOccurs="unbounded"/>
            </xsd:sequence>
            <xsd:attribute name="iso-date" type="xsd:date" use="required"/>
            <xsd:anyAttribute processContents="lax" namespace="##other"/>
          </xsd:complexType>
        </xsd:element>
        <xsd:element name="period-end" minOccurs="1" maxOccurs="1">
          <xsd:annotation>
            <xsd:documentation xml:lang="en">
              The end of the period (which must not be greater than one year)
            </xsd:documentation>
          </xsd:annotation>
          <xsd:complexType>
            <xsd:sequence>
              <xsd:any processContents="lax" namespace="##other" minOccurs="0" maxOccurs="unbounded"/>
            </xsd:sequence>
            <xsd:attribute name="iso-date" type="xsd:date" use="required"/>
            <xsd:anyAttribute processContents="lax" namespace="##other"/>
          </xsd:complexType>
        </xsd:element>
        <xsd:element name="value" type="currencyType" minOccurs="1" maxOccurs="1">
          <xsd:annotation>
            <xsd:documentation xml:lang="en">
              The total value of the organisation's aid budget for
              this period.
            </xsd:documentation>
          </xsd:annotation>
        </xsd:element>
        <xsd:element name="budget-line" minOccurs="0" maxOccurs="unbounded">
          <xsd:annotation>
            <xsd:documentation xml:lang="en">
              A breakdown of the total budget into sub-totals. The
              breakdown is determined by the reporting organisation
              and described in the narrative. The period covered is
              the same as that covered by the parent total-budget
              element. The sum of budget-line values does not have to
              equal the value given in the parent element.
            </xsd:documentation>
          </xsd:annotation>
          <xsd:complexType>
            <xsd:sequence>
              <xsd:element name="value" type="currencyType" minOccurs="1" maxOccurs="1">
                <xsd:annotation>
                  <xsd:documentation xml:lang="en">
                    The budget sub-total. The definition of the
                    sub-division is determined by
                    iati-organisation/total-budget/budget-line/narrative
                  </xsd:documentation>
                </xsd:annotation>
              </xsd:element>
              <xsd:element ref="narrative" minOccurs="1" maxOccurs="unbounded" />
              <xsd:any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
            </xsd:sequence>
            <xsd:attribute name="ref" use="optional" type="xsd:string">
              <xsd:annotation>
                <xsd:documentation xml:lang="en">
                  An internal reference for this budget line taken
                  from the reporting organisation's own system.
                  Optional.
                </xsd:documentation>
              </xsd:annotation>
            </xsd:attribute>
            <xsd:anyAttribute processContents="lax" namespace="##other"/>
          </xsd:complexType>
        </xsd:element>
        <xsd:any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
      </xsd:sequence>
      <xsd:anyAttribute processContents="lax" namespace="##other"/>
    </xsd:complexType>
  </xsd:element>

  <xsd:element name="recipient-org-budget">
    <xsd:annotation>
      <xsd:documentation xml:lang="en">
        The recipient-org-budget element allows for the reporting of
        forward looking budgets for each institution which receives
        core funding from the reporting organisation. The
        recommendation is that, where and when possible, annual
        planned budgets for each recipient institution for each of the
        next three financial years are reported. This is primarily
        applicable to donors but any provider of core funding is
        expected to use it. Earmarked budgets should be reported at
        activity-level through the Activity Standard.
      </xsd:documentation>
    </xsd:annotation>
    <xsd:complexType>
      <xsd:sequence>
        <xsd:element name="recipient-org" minOccurs="1" maxOccurs="1">
          <xsd:annotation>
            <xsd:documentation xml:lang="en">
              The organisation that will receive the funds.
            </xsd:documentation>
          </xsd:annotation>
          <xsd:complexType>
            <xsd:sequence>
              <xsd:element ref="narrative" minOccurs="1" maxOccurs="unbounded">
                <xsd:annotation>
                  <xsd:documentation xml:lang="en">
                    The name of the organisation. This can be repeated in multiple languages.
                  </xsd:documentation>
                </xsd:annotation>
              </xsd:element>
              <xsd:any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
            </xsd:sequence>
            <xsd:attribute name="ref" use="optional" type="xsd:string">
              <xsd:annotation>
                <xsd:documentation xml:lang="en">
                  Machine-readable identification string for the
                  organisation. Must be in the format {Registration Agency}
                  - (Registration Number} where {Registration Agency} is a
                  valid code in the Registration Agency code list and
                  {Registration Number } is a valid identifier issued by the
                  {Registration Agency}. If this is not present then the
                  narrative MUST contain the name of the organisation.
                </xsd:documentation>
              </xsd:annotation>
            </xsd:attribute>
          </xsd:complexType>
        </xsd:element>
        <xsd:element name="period-start" minOccurs="1" maxOccurs="1">
          <xsd:annotation>
            <xsd:documentation xml:lang="en">
              The start of the budget period.
            </xsd:documentation>
          </xsd:annotation>
          <xsd:complexType>
            <xsd:sequence>
              <xsd:any processContents="lax" namespace="##other" minOccurs="0" maxOccurs="unbounded"/>
            </xsd:sequence>
            <xsd:attribute name="iso-date" type="xsd:date" use="required"/>
            <xsd:anyAttribute processContents="lax" namespace="##other"/>
          </xsd:complexType>
        </xsd:element>
        <xsd:element name="period-end" minOccurs="1" maxOccurs="1">
          <xsd:annotation>
            <xsd:documentation xml:lang="en">
              The end of the period (which must not be greater than one year)
            </xsd:documentation>
          </xsd:annotation>
          <xsd:complexType>
            <xsd:sequence>
              <xsd:any processContents="lax" namespace="##other" minOccurs="0" maxOccurs="unbounded"/>
            </xsd:sequence>
            <xsd:attribute name="iso-date" type="xsd:date" use="required"/>
            <xsd:anyAttribute processContents="lax" namespace="##other"/>
          </xsd:complexType>
        </xsd:element>
        <xsd:element name="value" type="currencyType" minOccurs="1" maxOccurs="1">
          <xsd:annotation>
            <xsd:documentation xml:lang="en">
              The total value of the money budgeted to be disbursed to
              the specified recipient organisation during this time
              period.
            </xsd:documentation>
          </xsd:annotation>
        </xsd:element>
        <xsd:element name="budget-line" minOccurs="0" maxOccurs="unbounded">
          <xsd:annotation>
            <xsd:documentation xml:lang="en">
              A breakdown of the recipient organisation's budget into
              sub-totals. The breakdown is determined by the
              reporting organisation and described in the narrative.
              The period covered is the same as that covered by the
              parent recipient-org-budget element. The sum of
              budget-line values does not have to equal the value
              given in the parent element.
            </xsd:documentation>
          </xsd:annotation>
          <xsd:complexType>
            <xsd:sequence>
              <xsd:element name="value" type="currencyType" minOccurs="1" maxOccurs="1">
                <xsd:annotation>
                  <xsd:documentation xml:lang="en">
                    The budget sub-total. The definition of the
                    sub-division is determined by
                    iati-organisation/recipient-org-budget/budget-line/narrative
                  </xsd:documentation>
                </xsd:annotation>
              </xsd:element>
              <xsd:element ref="narrative" minOccurs="1" maxOccurs="unbounded" />
              <xsd:any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
            </xsd:sequence>
            <xsd:attribute name="ref" use="optional" type="xsd:string">
              <xsd:annotation>
                <xsd:documentation xml:lang="en">
                  An internal reference for this budget line taken
                  from the reporting organisation's own system.
                  Optional.
                </xsd:documentation>
              </xsd:annotation>
            </xsd:attribute>
            <xsd:anyAttribute processContents="lax" namespace="##other"/>
          </xsd:complexType>
        </xsd:element>
        <xsd:any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
      </xsd:sequence>
      <xsd:anyAttribute processContents="lax" namespace="##other"/>
    </xsd:complexType>
  </xsd:element>

  <xsd:element name="recipient-country-budget">
    <xsd:annotation>
      <xsd:documentation xml:lang="en">
        The recipient-country-budget element allows for the reporting of 
        forward looking budgets for each country in which the organisation 
        operates. The recommendation is that, where and when possible, the 
        organisation's total annual planned budget for each of the next 
        three financial years is reported for each recipient country. 
        It is strongly recommended that the start and end of the reported 
        financial years match those of the recipient country's 
        budgetary/planning cycle.
      </xsd:documentation>
    </xsd:annotation>
    <xsd:complexType>
      <xsd:sequence>
        <xsd:element name="recipient-country" minOccurs="1" maxOccurs="1">
          <xsd:annotation>
            <xsd:documentation xml:lang="en">
              The recipient country.
            </xsd:documentation>
          </xsd:annotation>
          <xsd:complexType>
            <xsd:sequence>
              <xsd:element ref="narrative" minOccurs="0" maxOccurs="unbounded" />
              <xsd:any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
            </xsd:sequence>
            <xsd:attribute name="code" type="xsd:string"  use="required">
              <xsd:annotation>
                <xsd:documentation xml:lang="en">
                  ISO 3166-1 alpha-2 code for the country.
                </xsd:documentation>
              </xsd:annotation>
            </xsd:attribute>
            <xsd:anyAttribute processContents="lax" namespace="##other"/>
          </xsd:complexType>
        </xsd:element>
        <xsd:element name="period-start" minOccurs="1" maxOccurs="1">
          <xsd:annotation>
            <xsd:documentation xml:lang="en">
              The start of the budget period.
            </xsd:documentation>
          </xsd:annotation>
          <xsd:complexType>
            <xsd:sequence>
              <xsd:any processContents="lax" namespace="##other" minOccurs="0" maxOccurs="unbounded"/>
            </xsd:sequence>
            <xsd:attribute name="iso-date" type="xsd:date" use="required"/>
            <xsd:anyAttribute processContents="lax" namespace="##other"/>
          </xsd:complexType>
        </xsd:element>
        <xsd:element name="period-end" minOccurs="1" maxOccurs="1">
          <xsd:annotation>
            <xsd:documentation xml:lang="en">
              The end of the period (which must not be greater than one year)
            </xsd:documentation>
          </xsd:annotation>
          <xsd:complexType>
            <xsd:sequence>
              <xsd:any processContents="lax" namespace="##other" minOccurs="0" maxOccurs="unbounded"/>
            </xsd:sequence>
            <xsd:attribute name="iso-date" type="xsd:date" use="required"/>
            <xsd:anyAttribute processContents="lax" namespace="##other"/>
          </xsd:complexType>
        </xsd:element>
        <xsd:element name="value" type="currencyType" minOccurs="1" maxOccurs="1">
          <xsd:annotation>
            <xsd:documentation xml:lang="en">
              The total value of the money budgeted to be disbursed to
              the specified country during this time period.  This
              element is required.
            </xsd:documentation>
          </xsd:annotation>
        </xsd:element>
        <xsd:element name="budget-line" minOccurs="0" maxOccurs="unbounded">
          <xsd:annotation>
            <xsd:documentation xml:lang="en">
              A breakdown of the recipient country's budget into
              sub-totals.  The breakdown is determined by the
              reporting organisation and described in the narrative.
              The period covered is the same as that covered by the
              parent recipient-country-budget element. The sum of
              budget-line values does not have to equal the value
              given in the parent element.
            </xsd:documentation>
          </xsd:annotation>
          <xsd:complexType>
            <xsd:sequence>
              <xsd:element name="value" type="currencyType" minOccurs="1" maxOccurs="1">
                <xsd:annotation>
                  <xsd:documentation xml:lang="en">
                    The budget sub-total. The definition of the
                    sub-division is determined by
                    iati-organisation/recipient-country-budget/budget-line/narrative
                  </xsd:documentation>
                </xsd:annotation>
              </xsd:element>
              <xsd:element ref="narrative" minOccurs="1" maxOccurs="unbounded" />
              <xsd:any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
            </xsd:sequence>
            <xsd:attribute name="ref" use="optional" type="xsd:string">
              <xsd:annotation>
                <xsd:documentation xml:lang="en">
                  An internal reference for this budget line taken
                  from the reporting organisation's own system.
                  Optional.
                </xsd:documentation>
              </xsd:annotation>
            </xsd:attribute>
            <xsd:anyAttribute processContents="lax" namespace="##other"/>
          </xsd:complexType>
        </xsd:element>
        <xsd:any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
      </xsd:sequence>
      <xsd:anyAttribute processContents="lax" namespace="##other"/>
    </xsd:complexType>
  </xsd:element>

  <xsd:element name="document-link">
    <xsd:annotation>
      <xsd:documentation xml:lang="en">
        A  link to an online, publicly accessible web page or
        document.
      </xsd:documentation>
    </xsd:annotation>
    <xsd:complexType>
      <xsd:sequence>
        <xsd:element ref="title" minOccurs="1" maxOccurs="1"/>
        <xsd:element name="category" minOccurs="1" maxOccurs="unbounded">
          <xsd:annotation>
            <xsd:documentation xml:lang="en">
              IATI Document Category Code
            </xsd:documentation>
          </xsd:annotation>
          <xsd:complexType>
            <xsd:sequence>
              <xsd:any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
            </xsd:sequence>
            <xsd:attribute name="code" use="required" type="xsd:string">
              <xsd:annotation>
                <xsd:documentation xml:lang="en">
                  An IATI code defining the category of the document.
                </xsd:documentation>
              </xsd:annotation>
            </xsd:attribute>
            <xsd:anyAttribute processContents="lax" namespace="##other"/>
          </xsd:complexType>
        </xsd:element>
        <xsd:element name="language" minOccurs="0" maxOccurs="unbounded">
          <xsd:annotation>
            <xsd:documentation xml:lang="en">
              The ISO 639-1 language code in which target document is
              written, e.g. "en". Can be repeated to describe
              multi-lingual documents.
            </xsd:documentation>
          </xsd:annotation>
          <xsd:complexType>
            <xsd:sequence>
              <xsd:any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
            </xsd:sequence>
            <xsd:attribute name="code" use="required" type="xsd:string">
              <xsd:annotation>
                <xsd:documentation xml:lang="en">
                  ISO 639-1 language code
                </xsd:documentation>
              </xsd:annotation>
            </xsd:attribute>
            <xsd:anyAttribute processContents="lax" namespace="##other"/>
          </xsd:complexType>
        </xsd:element>
        <xsd:element name="recipient-country" minOccurs="0" maxOccurs="unbounded">
          <xsd:annotation>
            <xsd:documentation xml:lang="en">
              The recipient country that is the focus of the document.
              May be repeated for multiple countries.
            </xsd:documentation>
          </xsd:annotation>
          <xsd:complexType>
            <xsd:sequence>
              <xsd:element ref="narrative" minOccurs="0" maxOccurs="unbounded" />
              <xsd:any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
            </xsd:sequence>
            <xsd:attribute name="code" type="xsd:string"  use="required">
              <xsd:annotation>
                <xsd:documentation xml:lang="en">
                  ISO 3166-1 alpha-2 code for the country.
                </xsd:documentation>
              </xsd:annotation>
            </xsd:attribute>
            <xsd:anyAttribute processContents="lax" namespace="##other"/>
          </xsd:complexType>
        </xsd:element>
        <xsd:any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
      </xsd:sequence>
      <xsd:attribute name="url" type="xsd:anyURI" use="required">
        <xsd:annotation>
          <xsd:documentation xml:lang="en">
            The target URL of the external document, e.g. "http://www.example.org/doc.odt".
          </xsd:documentation>
        </xsd:annotation>
      </xsd:attribute>
      <xsd:attribute name="format" type="xsd:string" use="required">
        <xsd:annotation>
          <xsd:documentation xml:lang="en">
            An IANA code for the MIME type of the document being
            referenced, e.g. "application/pdf". 
          </xsd:documentation>
        </xsd:annotation>
      </xsd:attribute>
      <xsd:anyAttribute processContents="lax" namespace="##other"/>
    </xsd:complexType>
  </xsd:element>



  <xsd:complexType name="currencyType">
    <xsd:annotation>
      <xsd:documentation xml:lang="en">
        Data type for an element containing a currency value.
      </xsd:documentation>
    </xsd:annotation>
    <xsd:simpleContent>
      <xsd:extension base="xsd:decimal">
        <xsd:attribute ref="currency" use="optional"/>
        <xsd:attribute ref="value-date" use="required"/>
        <xsd:anyAttribute processContents="lax" namespace="##other"/>
      </xsd:extension>
    </xsd:simpleContent>
  </xsd:complexType>

  <xsd:attribute name="currency" type="xsd:string">
    <xsd:annotation>
      <xsd:documentation xml:lang="en">
        A three letter ISO 4217 code for the original currency of the
        amount. This is required for all currency amounts unless
        the iati-organisation/\@default-currency attribute is
        specified.
      </xsd:documentation>
    </xsd:annotation>
  </xsd:attribute>


</xsd:schema>
