<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema targetNamespace="http://water.usgs.gov/XML/NWIS/5.0" 
            xmlns="http://water.usgs.gov/XML/NWIS/5.0" version="5.0" elementFormDefault="qualified"
            xmlns:nwis="http://water.usgs.gov/XML/NWIS/5.0"
            xmlns:xsd="http://www.w3.org/2001/XMLSchema">
    
  <xsd:include schemaLocation="ProcessingOptions.xsd"/>
  <xsd:include schemaLocation="site/Site.xsd"/>
  <xsd:include schemaLocation="sitevisit/FieldEquipment.xsd"/>
  <xsd:include schemaLocation="sitevisit/EquipmentActivities.xsd"/>
  <xsd:include schemaLocation="shared/IEEE754FloatValue.xsd"/>
  <xsd:include schemaLocation="shared/RecordHistory.xsd"/>
  <xsd:include schemaLocation="shared/DateTimeWithDatum.xsd"/>
  <xsd:include schemaLocation="shared/DataAgingCode.xsd"/>
  <xsd:include schemaLocation="shared/string1.xsd"/>
  <xsd:include schemaLocation="shared/string16.xsd"/>
  <xsd:include schemaLocation="shared/Equipment.xsd"/>
	
  <xsd:element name="Source">
    <xsd:annotation>
      <xsd:documentation>
        <Definition>Information describing the source of the data within this document and/or the device or software that has created this XML Document.</Definition>
      </xsd:documentation>
    </xsd:annotation>
    <xsd:complexType>
      <xsd:sequence>
        <xsd:element name="Equipment" type="Equipment" minOccurs="0">
          <xsd:annotation>
            <xsd:documentation>
              <Definition>The device that produced this XML document.</Definition>
            </xsd:documentation>
          </xsd:annotation>
        </xsd:element>
        <xsd:element name="SoftwareName" type="xsd:string" minOccurs="0">
          <xsd:annotation>
            <xsd:documentation>
              <Definition>The name of the software that produced this XML document.</Definition>
            </xsd:documentation>
          </xsd:annotation>
        </xsd:element>
        <xsd:element name="SoftwareVersionText" type="xsd:string" minOccurs="0">
          <xsd:annotation>
            <xsd:documentation>
              <Definition>The version of the software that produced this XML document.</Definition>
            </xsd:documentation>
          </xsd:annotation>
        </xsd:element>
        <xsd:element name="AgencyCode" type="xsd:string" minOccurs="0">
          <xsd:annotation>
	    <xsd:documentation>
              <Definition>The agency supplying this XML document.</Definition>
	    </xsd:documentation>
          </xsd:annotation>
        </xsd:element>
        <xsd:element name="DataBaseName" type="xsd:string" minOccurs="0">
	  <xsd:annotation>
            <xsd:documentation>
              <Definition>The name of the data base containing this data in this XML document.</Definition>
            </xsd:documentation>
	  </xsd:annotation>
        </xsd:element>
        <xsd:element name="DataBaseNumber" type="xsd:string" minOccurs="0">
	  <xsd:annotation>
            <xsd:documentation>
              <Definition>The NWIS internal database number of the data base containing this data in this XML document.</Definition>
            </xsd:documentation>
	  </xsd:annotation>
        </xsd:element>
        <xsd:element name="RemarksText" type="xsd:string" minOccurs="0">
	  <xsd:annotation>
            <xsd:documentation>
              <Definition>Comments about the source of this XML document.</Definition>
            </xsd:documentation>
          </xsd:annotation>
        </xsd:element>
        <xsd:element name="EmailAddress" type="xsd:string" minOccurs="0">
	  <xsd:annotation>
            <xsd:documentation>
              <Definition>The electronic-mail address of the person to receive notification of processing of this XML file.</Definition>
            </xsd:documentation>
	  </xsd:annotation>
        </xsd:element>
      </xsd:sequence>
    </xsd:complexType>
  </xsd:element>

  <xsd:element name="RetrievalPeriod">
    <xsd:annotation>
      <xsd:documentation>
        <Definition>The retrieval period for the data in this file. This retrieval period is primarily used in operations to write the data back into the database.</Definition>
      </xsd:documentation>
    </xsd:annotation>
    <xsd:complexType>
      <xsd:sequence>
        <xsd:choice>
          <xsd:element name="StartDate" type="xsd:date">
            <xsd:annotation>
              <xsd:documentation>
                <Definition>The starting date for the retrieval period.</Definition>
              </xsd:documentation>
            </xsd:annotation>
          </xsd:element>
          <xsd:element name="StartDateTime" type="DateTimeWithDatum">
            <xsd:annotation>
              <xsd:documentation>
                <Definition>The starting date and time for the retrieval period.</Definition>
              </xsd:documentation>
            </xsd:annotation>
          </xsd:element>
        </xsd:choice>
        <xsd:choice>
          <xsd:element name="EndDate" type="xsd:date">
            <xsd:annotation>
              <xsd:documentation>
                <Definition>The ending data for this retrieval.</Definition>
              </xsd:documentation>
            </xsd:annotation>
          </xsd:element>
          <xsd:element name="EndDateTime" type="DateTimeWithDatum">
            <xsd:annotation>
              <xsd:documentation>
                <Definition>The ending data and time for this retrieval.</Definition>
              </xsd:documentation>
            </xsd:annotation>
          </xsd:element>
        </xsd:choice>
      </xsd:sequence>
    </xsd:complexType>
   </xsd:element>

    <xsd:element name="HandlingHistory">
      <xsd:annotation>
        <xsd:documentation>
          <Definition>A record of the history of the handling of this XML Document. This could include the creation of the XML document, the loading of the contents of the XML document into a data base (including any errors encountered), or transfers or movement of the XML document.</Definition>
        </xsd:documentation>
      </xsd:annotation>
      <xsd:complexType>
        <xsd:sequence>
          <xsd:element name="HistoryDateTime" type="DateTimeWithDatum">
	    <xsd:annotation>
              <xsd:documentation>
		<Definition>The date and time of the handling of the XML document.</Definition>
              </xsd:documentation>
	    </xsd:annotation>
          </xsd:element>
          <xsd:element name="UserIdentifier" type="xsd:string">
	    <xsd:annotation>
              <xsd:documentation>
		<Definition>Comments on the handling of this XML document.</Definition>
              </xsd:documentation>
	    </xsd:annotation>
          </xsd:element>
          <xsd:element name="RemarksText" type="xsd:string" minOccurs="0">
	    <xsd:annotation>
              <xsd:documentation>
		<Definition>Comments on the handling of this XML document.</Definition>
              </xsd:documentation>
	    </xsd:annotation>
          </xsd:element>
        </xsd:sequence>
      </xsd:complexType>
    </xsd:element>
    <xsd:element name="UsgsHydroML">
      <xsd:annotation>
        <xsd:documentation source="http://water.usgs.gov/nwis_activities/xml/nwis_hml.html">
          <Definition>HYDROML is an XML format developed for the transport and archival of hydologic data HYDROML was developed by the National Water Information System (NWIS) office of the United States Geological Survey for the purposes of importing, exporting, and archiving hydrologic data from and to the NWIS data base. The types of hydrologic data include site information, computation instructions, corrections, ratings, shifts, time-series data including unit values and daily value statistics, peak flows, and site visit measurements. There are many differrent uses possible for HYDROML and not all data elements are used in every case. In fact many data elements will not be used depending upon the data content desired or the usage of the XML file.There are many different usage examples that are possible but the combinations are too numerous to list here. Please refer to the web site for example XML files.</Definition>
        </xsd:documentation>
      </xsd:annotation>
    <xsd:complexType>
      <xsd:sequence>
        <xsd:element name="Version" type="xsd:string"/>
        <xsd:element ref="Source"/>
        <xsd:element ref="RetrievalPeriod" minOccurs="0"/>
        <xsd:element name="UnitsFamily">
	  <xsd:simpleType>
            <xsd:restriction base="xsd:NMTOKEN">
              <xsd:enumeration value="English"/>
              <xsd:enumeration value="Metric"/>
            </xsd:restriction>
          </xsd:simpleType>
        </xsd:element>
        <xsd:element ref="ProcessingOptions" minOccurs="0"/>
        <xsd:element ref="FieldEquipment" minOccurs="0"/>
        <xsd:element ref="EquipmentActivities" minOccurs="0"/>
        <xsd:element ref="Site" minOccurs="0" maxOccurs="unbounded"/>
        <xsd:element ref="HandlingHistory" minOccurs="0" maxOccurs="unbounded"/>
      </xsd:sequence>
    </xsd:complexType>
  </xsd:element>
</xsd:schema>
