<?xml version="1.0" encoding="utf-8"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
	    targetNamespace="http://www.wa5znu.org/2006/04/xdif/" 
	    xmlns:xdif="http://www.wa5znu.org/2006/04/xdif/"
	    elementFormDefault="qualified">
  

  <xsd:simpleType name="degrees180">
    <xsd:restriction base='xsd:decimal'>
      <xsd:maxInclusive value='180'/>
      <xsd:minInclusive value='-180'/>
    </xsd:restriction>
  </xsd:simpleType>

  <xsd:simpleType name="degrees90">
    <xsd:restriction base='xsd:decimal'>
      <xsd:maxInclusive value='90'/>
      <xsd:minInclusive value='-90'/>
    </xsd:restriction>
  </xsd:simpleType>

  <xsd:simpleType name="multiLineString">
    <xsd:restriction base="xsd:string">
      <!-- xsd:whiteSpace value="preserve"/ -->
    </xsd:restriction>
  </xsd:simpleType>

  <xsd:simpleType name="rst">
    <xsd:restriction base="xsd:string" />
  </xsd:simpleType>

  <!-- function of STATE 	  	
  the contacted station's Secondary Political Subdivision of contacted station
  (e.g. US county, JA prefecture), 
  in the format PrimarySubdivisionAbbreviation,SecondarySubdivisionName
  -->
  <xsd:simpleType name="county">
    <xsd:restriction base="xsd:string">
    </xsd:restriction>
  </xsd:simpleType>

  <!-- 
  Function of Country Code 	  	
  The standard abbreviation for the station's
  Primary Political Subdivision (e.g. US State, JA Island, VE Province) 
  -->
  <xsd:simpleType name="state">
    <xsd:restriction base="xsd:string" />
  </xsd:simpleType>

  <!-- Bands -->
  <xsd:simpleType name="band">
    <!-- See band.xml for sample values -->
    <xsd:restriction base="xsd:string" />
  </xsd:simpleType>

  <!-- IOTA designator -->
  <xsd:simpleType name="iota">
    <xsd:restriction base="xsd:string">
      <xsd:pattern value="[NA|SA|EU|AF|OC|AS|AN]-[0-9]+" />
    </xsd:restriction>
  </xsd:simpleType>

  <!-- ARRL Section -->
  <xsd:simpleType name="arrl_section">
    <!-- See arrl_sections.xml for legal values -->
    <xsd:restriction base="xsd:string">
      <xsd:enumeration value="CT" /> <!-- Connecticut -->
      <xsd:enumeration value="EMA" /> <!-- Eastern Massachusetts -->
      <xsd:enumeration value="ME" /> <!-- Maine -->
      <xsd:enumeration value="NH" /> <!-- New Hampshire -->
      <xsd:enumeration value="RI" /> <!-- Rhode Island -->
      <xsd:enumeration value="VT" /> <!-- Vermont -->
      <xsd:enumeration value="WMA" /> <!-- Western Massachusetts -->
      <xsd:enumeration value="ENY" /> <!-- Eastern New York -->
      <xsd:enumeration value="NLI" /> <!-- New York City-Long Island -->
      <xsd:enumeration value="NNJ" /> <!-- Northern New Jersey -->
      <xsd:enumeration value="NNY" /> <!-- Northern New York -->
      <xsd:enumeration value="SNJ" /> <!-- Southern New Jersey -->
      <xsd:enumeration value="WNY" /> <!-- Western New York -->
      <xsd:enumeration value="DE" /> <!-- Delaware -->
      <xsd:enumeration value="EPA" /> <!-- Eastern Pennsylvania -->
      <xsd:enumeration value="MDC" /> <!-- Maryland-DC -->
      <xsd:enumeration value="WPA" /> <!-- Western Pennsylvania -->
      <xsd:enumeration value="AL" /> <!-- Alabama -->
      <xsd:enumeration value="GA" /> <!-- Georgia -->
      <xsd:enumeration value="KY" /> <!-- Kentucky -->
      <xsd:enumeration value="NC" /> <!-- North Carolina -->
      <xsd:enumeration value="NFL" /> <!-- Northern Florida -->
      <xsd:enumeration value="SC" /> <!-- South Carolina -->
      <xsd:enumeration value="SFL" /> <!-- Southern Florida -->
      <xsd:enumeration value="TN" /> <!-- Tennessee -->
      <xsd:enumeration value="VA" /> <!-- Virginia -->
      <xsd:enumeration value="PR" /> <!-- Puerto Rico -->
      <xsd:enumeration value="VI" /> <!-- Virgin Islands -->
      <xsd:enumeration value="AR" /> <!-- Arkansas -->
      <xsd:enumeration value="LA" /> <!-- Louisiana -->
      <xsd:enumeration value="MS" /> <!-- Mississippi -->
      <xsd:enumeration value="NM" /> <!-- New Mexico -->
      <xsd:enumeration value="NTX" /> <!-- North Texas -->
      <xsd:enumeration value="OK" /> <!-- Oklahoma -->
      <xsd:enumeration value="STX" /> <!-- South Texas -->
      <xsd:enumeration value="WTX" /> <!-- West Texas -->
      <xsd:enumeration value="EB" /> <!-- East Bay -->
      <xsd:enumeration value="LAX" /> <!-- Loas Angeles -->
      <xsd:enumeration value="ORG" /> <!-- Orange -->
      <xsd:enumeration value="SB" /> <!-- Santa Barbara -->
      <xsd:enumeration value="SCV" /> <!-- Santa Clara Valley -->
      <xsd:enumeration value="SDG" /> <!-- San Diego -->
      <xsd:enumeration value="SF" /> <!-- San Francisco -->
      <xsd:enumeration value="SJV" /> <!-- San Joaquin Valley -->
      <xsd:enumeration value="SV" /> <!-- Sacramento Valley -->
      <xsd:enumeration value="PAC" /> <!-- Pacific -->
      <xsd:enumeration value="AZ" /> <!-- Arizona -->
      <xsd:enumeration value="EWA" /> <!-- Eastern Washington -->
      <xsd:enumeration value="ID" /> <!-- Idaho -->
      <xsd:enumeration value="MT" /> <!-- Montana -->
      <xsd:enumeration value="NV" /> <!-- Nevada -->
      <xsd:enumeration value="OR" /> <!-- Oregon -->
      <xsd:enumeration value="UT" /> <!-- Utah -->
      <xsd:enumeration value="WWA" /> <!-- Western Washington -->
      <xsd:enumeration value="WY" /> <!-- Wyoming -->
      <xsd:enumeration value="AK" /> <!-- Alaska -->
      <xsd:enumeration value="MI" /> <!-- Michigan -->
      <xsd:enumeration value="OH" /> <!-- Ohio -->
      <xsd:enumeration value="WV" /> <!-- West Virginia -->
      <xsd:enumeration value="IL" /> <!-- Illinois -->
      <xsd:enumeration value="IN" /> <!-- Indiana -->
      <xsd:enumeration value="WI" /> <!-- Wisconsin -->
      <xsd:enumeration value="CO" /> <!-- Colorado -->
      <xsd:enumeration value="IA" /> <!-- Iowa -->
      <xsd:enumeration value="KS" /> <!-- Kansas -->
      <xsd:enumeration value="MN" /> <!-- Minnesota -->
      <xsd:enumeration value="MO" /> <!-- Missouri -->
      <xsd:enumeration value="NE" /> <!-- Nebraska -->
      <xsd:enumeration value="ND" /> <!-- North Dakota -->
      <xsd:enumeration value="SD" /> <!-- South Dakota -->
    </xsd:restriction>
  </xsd:simpleType>

  <!-- RAC Section -->
  <xsd:simpleType name="rac_section">
    <!-- See rac.xml for legal values -->
    <xsd:restriction base="xsd:string">
      <xsd:enumeration value="MAR" /> <!-- Maritime-Newfoundland -->
      <xsd:enumeration value="QC" /> <!-- Quebec -->
      <xsd:enumeration value="ON" /> <!-- Ontario -->
      <xsd:enumeration value="MB" /> <!-- Manitoba -->
      <xsd:enumeration value="SK" /> <!-- Saskatchewan -->
      <xsd:enumeration value="AB" /> <!-- Alberta -->
      <xsd:enumeration value="BC" /> <!-- British Columbia -->
      <xsd:enumeration value="NWT" /> <!-- Nortwest Territories/Yukon -->
    </xsd:restriction>
  </xsd:simpleType>


  <!-- The station's call -->
  <xsd:simpleType name="callsign">
    <xsd:restriction base="xsd:string">
      <xsd:pattern value="[a-zA-Z0-9]+(/[a-zA-Z0-9]+)?" />
    </xsd:restriction>
  </xsd:simpleType>


  <!-- The station's Country -->
  <xsd:simpleType name="country">
    <xsd:restriction base="xsd:string" />
  </xsd:simpleType>


  <!-- The station's continent -->
  <xsd:simpleType name="continent">
    <xsd:restriction base="xsd:string">
      <xsd:enumeration value="NA"/>
      <xsd:enumeration value="SA"/>
      <xsd:enumeration value="EU"/>
      <xsd:enumeration value="AF"/>
      <xsd:enumeration value="OC"/>
      <xsd:enumeration value="AS"/>
    </xsd:restriction>
  </xsd:simpleType>

  <!-- The station's Maidenhead Grid Square -->
  <xsd:simpleType name="gridsquare">
    <xsd:restriction base="xsd:string">
      <xsd:pattern value="[A-Z][A-Z][0-9][0-9]([a-z][a-z])?" />
    </xsd:restriction>
  </xsd:simpleType>

  <!-- The station's CQ Zone -->
  <xsd:simpleType name="cq_zone">
    <xsd:restriction base="xsd:integer" />
  </xsd:simpleType>

  <!-- The station's ITU Zone -->
  <xsd:simpleType name="itu_zone">
    <xsd:restriction base="xsd:integer" />
  </xsd:simpleType>

  <!-- Description of the station's rig (see equipment) -->
  <xsd:simpleType name="rig">
    <xsd:restriction base="xdif:multiLineString" />
  </xsd:simpleType>

  <!-- This element is "abstract" and a member of its substitution group is always used -->
  <xsd:complexType name="propagationModeBase">
    <xsd:sequence minOccurs="0" maxOccurs="0" />
  </xsd:complexType>

  <xsd:complexType name="propagationMode" >
    <xsd:complexContent>
      <xsd:extension base="xdif:propagationModeBase" />
    </xsd:complexContent>
  </xsd:complexType>

  <xsd:element name="propagationMode" type="xdif:propagationMode" abstract="true" />

  <!-- Propagation mode container -->
  <xsd:complexType name="propagation">
    <xsd:sequence>
      <xsd:element ref="xdif:propagationMode" minOccurs="0" maxOccurs="unbounded" />
    </xsd:sequence>
  </xsd:complexType>

  <!-- Antenna -->
  <xsd:complexType name="antenna">
    <xsd:simpleContent>
      <xsd:extension base="xsd:string">
	<xsd:attribute name="azimuth" type="xdif:degrees90" use="optional"/>	<!-- Antenna azimuth, in degrees -->
	<xsd:attribute name="elevation" type="xdif:degrees180" use="optional" /><!-- Antenna elevation, in degrees -->
	<xsd:attribute name="height" type="xsd:decimal" use="optional" /><!-- Antenna height, meters -->
	<xsd:anyAttribute namespace="##other" />	<!-- Allow foreign attributes -->
      </xsd:extension>
    </xsd:simpleContent>
  </xsd:complexType>


  <xsd:attributeGroup name="powerSourceQualifiers">
    <xsd:attribute name="natural" type="xsd:boolean" use="optional" />
    <xsd:attribute name="emergency" type="xsd:boolean" use="optional" />
    <xsd:anyAttribute namespace="##other" />	<!-- Allow foreign attributes -->
  </xsd:attributeGroup>
  
  <xsd:complexType name="powersource">
    <xsd:sequence minOccurs="1" maxOccurs="unbounded">
      <xsd:choice>
	<xsd:element name="mains">
	  <xsd:complexType>
	    <xsd:simpleContent>
	      <xsd:extension base="xdif:booleanWithAttributes">
		<xsd:attributeGroup ref="xdif:powerSourceQualifiers" />
	      </xsd:extension>
	    </xsd:simpleContent>
	  </xsd:complexType>
	</xsd:element>
	<xsd:element name="battery">
	  <xsd:complexType>
	    <xsd:simpleContent>
	      <xsd:extension base="xdif:booleanWithAttributes">
		<xsd:attributeGroup ref="xdif:powerSourceQualifiers" />
	      </xsd:extension>
	    </xsd:simpleContent>
	  </xsd:complexType>
	</xsd:element>
	<xsd:element name="generator">
	  <xsd:complexType>
	    <xsd:simpleContent>
	      <xsd:extension base="xdif:booleanWithAttributes">
		<xsd:attributeGroup ref="xdif:powerSourceQualifiers" />
	      </xsd:extension>
	    </xsd:simpleContent>
	  </xsd:complexType>
	</xsd:element>
	<!-- Other is provided so you can find QSOs that require only certain @natural or @emergency power but are not one of the existing types -->
	<xsd:element name="other">
	</xsd:element>
	<!-- Use Other namespaces for power types if you really care.  Their Schemas should allow powerSourceQualifiers -->
	<xsd:any namespace="##other" />
      </xsd:choice>
    </xsd:sequence>
  </xsd:complexType>

  <!-- Generic boolean content with attributes -->
  <xsd:complexType name="booleanWithAttributes">
    <xsd:simpleContent>
      <xsd:extension base="xsd:string">
	<xsd:attribute name="value" type="xsd:string"/>
	<xsd:anyAttribute namespace="##other" />	       <!--Allow foreign attributes-->
      </xsd:extension>
    </xsd:simpleContent>
  </xsd:complexType>

  <!-- Generic mixed content -->
   <xsd:complexType name="mixed" >
     <xsd:sequence minOccurs="0" maxOccurs="unbounded">
       <xsd:any namespace="##any" processContents="skip" />
     </xsd:sequence>
  </xsd:complexType>

  <!-- An XML qualified value that doesn't include a colon; i.e., is always qualified and is not in the XDIF namespace. -->
  <xsd:simpleType name="QNameButNotNCNAME">
    <xsd:restriction base="xsd:QName">
      <xsd:pattern value="[^:]+:[^:]+"/>
    </xsd:restriction>
  </xsd:simpleType>


</xsd:schema>


