<?xml version="1.0"?>
<schema xmlns="http://www.w3.org/2001/XMLSchema" 
            targetNamespace="http://www.hans-support.de/specs/hansxml/0.7/" 
            xmlns:hans="http://www.hans-support.de/specs/hansxml/0.7/" 
            elementFormDefault="qualified" 
            attributeFormDefault="unqualified" 
  >
  <annotation>
    <documentation>
          $Id: hansxml.xsd 20640 2007-08-26 22:48:35Z ThB $

          XML Schema Definition fuer HANSXML

          Version 0.7   - Added @type and @method

          Version 0.6-1 - first xsd version of hansxml
     </documentation>
  </annotation>

 <element name="hanscoll">
  <complexType>
   <sequence maxOccurs="unbounded">
     <element ref="hans:record"/>
   </sequence>
  </complexType>
 </element>

 <element name="record">
  <complexType>
   <sequence>
     <element name="sort" type="hans:sortType" minOccurs="0"/>
     <element ref="hans:hansfield" maxOccurs="unbounded"/>
   </sequence>
   <attribute name="id" use="required" type="hans:idType"/>
   <attribute name="primkey" use="required" type="hans:idType"/>
   <attribute name="recno" type="nonNegativeInteger"/>
   <attribute name="parent" type="hans:idType"/>
  </complexType>
 </element>


 <element type="hans:fieldType" name="hansfield">
 </element>

 <element type="hans:subfieldType" name="subfield">
 </element>

  <complexType name="fieldType" mixed="true">
    <complexContent>
      <extension base="hans:textType">
        <choice minOccurs="0" maxOccurs="unbounded">
          <element ref="hans:subfield"/>
        </choice>
        <attribute name="tag" use="required"/>
        <attribute name="repet" type="hans:repetcodeType"/>
        <attribute name="irepet" type="nonNegativeInteger"/>
        <attribute name="comment"/>
      </extension>
    </complexContent>
  </complexType>

  <complexType name="subfieldType" mixed="true">
    <complexContent>
      <extension base="hans:textType">
        <attribute name="code" type="hans:subfieldcodeType" use="required"/>
        <attribute name="comment"/>
      </extension>
    </complexContent>
  </complexType>

  <complexType name="textType" mixed="true">
    <complexContent>
      <extension base="hans:plaintextType">
        <choice minOccurs="0" maxOccurs="unbounded">
          <element ref="hans:hanscode"/>
          <element ref="hans:reference"/>
        </choice>
      </extension>
    </complexContent>
  </complexType>

  <complexType name="plaintextType" mixed="true">
   <choice minOccurs="0" maxOccurs="unbounded">
    <element ref="hans:nosort"/>
   </choice>
  </complexType>

 <element name="hanscode">
  <complexType>
   <simpleContent>
    <extension base="string">
     <attribute name="expansion" type="string"/>
    </extension>
   </simpleContent>
  </complexType>
 </element>

 <element name="nosort">
  <complexType>
   <simpleContent>
    <extension base="string">
     <attribute name="unbalanced"/>
    </extension>
   </simpleContent>
  </complexType>
 </element>

 <element name="reference">
  <complexType mixed="true">
   <choice minOccurs="0" maxOccurs="unbounded">
    <element ref="hans:nosort"/>
    <element ref="hans:refsubfield"/>
   </choice>
  <attribute name="toid" use="required" type="hans:idType"/>
  <attribute name="type"/>
  </complexType>
 </element>

 <element name="refsubfield">
  <complexType mixed="true">
   <choice minOccurs="0" maxOccurs="unbounded">
    <element ref="hans:nosort"/>
   </choice>
  <attribute name="code" type="hans:subfieldcodeType" use="required"/>
  <attribute name="comment"/>
  <attribute name="method"/>
  </complexType>
 </element>

  <simpleType name="subfieldcodeType">
    <restriction base="string">
      <length value="1" fixed="true"/>
    </restriction>
  </simpleType>

  <simpleType name="repetcodeType">
    <restriction base="string">
      <maxLength value="1" fixed="true"/>
    </restriction>
  </simpleType>

  <simpleType name="idType">
    <restriction base="anyURI">
      <pattern value="[a-z][0-9a-z]+(\+[0-9a-z]+)*"/>
    </restriction>
  </simpleType>


 <complexType name="sortType">
  <annotation>
   <documentation>
         optionale Sortierhilfe fuer records: sortkey ist der mechanisch sortierbare Schluessel,
                                              sortcaption der darzustellende Text
    </documentation>
  </annotation>
   <sequence>
     <element name="sortkey" type="string"/>
     <element name="sortcaption" minOccurs="0" type="hans:plaintextType"/>
   </sequence>
 </complexType>

</schema>

