<schema xmlns="http://www.w3.org/2001/XMLSchema"
   targetNamespace="http://www.openarchives.org/OAI/1.1/oai_marc"
   xmlns:oai_marc="http://www.openarchives.org/OAI/1.1/oai_marc"
   elementFormDefault="qualified"
   attributeFormDefault="unqualified">

   <annotation>
     <documentation>
      Schema for MARC metadata format.
      MARC semantics available at http://www.loc.gov/marc/
      .....
      This Schema has been successfully applied for MARC21 records.  It is likely to also work 
      for older versions of USMARC and CANMARC.  Application of this Schema for other MARC 
      formats has not been tested and may require some adjustments. 
      ..... 
      the Open Archives Initiative. 2000. 
      Herbert Van de Sompel
      MARC XML transportation format on which this schema is inspired 
           available at http://www.dlib.vt.edu/projects/OAi/marcxml/marcxml.html
     This Schema validated at http://www.w3.org/2001/03/webdata/xsv on 05-09-2001.
     </documentation>
    </annotation>

  <element name="oai_marc">
   <complexType>
     <sequence>
       <element ref="oai_marc:fixfield" minOccurs="1" maxOccurs="unbounded"/>
       <element ref="oai_marc:varfield" minOccurs="0" maxOccurs="unbounded"/>
     </sequence>
    <attribute name="status" type="string" use="optional"/>
    <attribute name="type" type="string" use="required"/>
    <attribute name="level" type="string" use="required"/>
    <attribute name="ctlType" type="string" use="optional"/>
    <attribute name="charEnc" type="string" use="optional"/>
    <attribute name="encLvl" type="string" use="optional"/>
    <attribute name="catForm" type="string" use="optional"/>
    <attribute name="lrRqrd" type="string" use="optional"/>
   </complexType>
  </element>

  <element name="fixfield">
   <complexType>
     <simpleContent>
        <extension base="oai_marc:fixfieldType">
        <attribute name="id" type="oai_marc:idType" use="required"/>
        </extension>
     </simpleContent>
   </complexType>
  </element>

  <simpleType name="fixfieldType">
    <restriction base="string">
    <!-- fixfield must be enclosed between quotes because spaces are meaningfull -->
     <pattern value='[\n\r\t\s]*"[^"]*"[\n\r\t\s]*'/>
    </restriction>
  </simpleType>

  <element name="varfield">
   <complexType>
     <sequence>
       <element ref="oai_marc:subfield" minOccurs="1" maxOccurs="unbounded"/>
     </sequence>
    <attribute name="id" type="oai_marc:idType" use="required"/>
    <attribute name="i1" type="oai_marc:iType" use="required"/>
    <attribute name="i2" type="oai_marc:iType" use="required"/>
   </complexType>
  </element>

  <element name="subfield">
   <complexType>
     <simpleContent>
        <extension base="string">
        <attribute name="label" type="oai_marc:subfieldType" use="required"/>
        </extension>
     </simpleContent>
   </complexType>
  </element>

  <simpleType name="subfieldType">
    <restriction base="string">
    <!-- MARC subfield (the leading $ i not used)
         may be any lowercase alphabetic or numeric character  -->
     <pattern value="[0-9a-z]"/>
    </restriction>
  </simpleType>

  <simpleType name="idType">
    <restriction base="string">
    <!-- MARC tags are 1 to 3 digits -->
     <pattern value="[0-9]{1,3}"/>
    </restriction>
  </simpleType>

  <simpleType name="iType">
    <restriction base="string">
    <!-- MARC indicator may be any lowercase alphabetic or numeric character or a blank  -->
     <pattern value="[0-9a-z\s]?"/>
    </restriction>
  </simpleType>


 </schema>
