<?xml version = "1.0" encoding = "UTF-8"?>
<!--
/*   Copyright 2004 The Apache Software Foundation
 *
 *   Licensed under the Apache License, Version 2.0 (the "License");
 *   you may not use this file except in compliance with the License.
 *   You may obtain a copy of the License at
 *
 *       http://www.apache.org/licenses/LICENSE-2.0
 *
 *   Unless required by applicable law or agreed to in writing, software
 *   distributed under the License is distributed on an "AS IS" BASIS,
 *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *   See the License for the specific language governing permissions and
 *  limitations under the License.
 */
-->

<xsd:schema xmlns:xsd = "http://www.w3.org/2001/XMLSchema">
  <xsd:element name="doc">
    <xsd:complexType>
      <xsd:sequence>
<xsd:element ref="defns" minOccurs="1" maxOccurs="1"/>
<xsd:element ref="refs" minOccurs="1" maxOccurs="1"/>
      </xsd:sequence>
    </xsd:complexType>
    <xsd:key name="enumKeys">
      <xsd:selector xpath=".//defns/enumDef"/>
      <xsd:field xpath="@key"/>
    </xsd:key>
    <xsd:keyref name="enumKeyRef" refer="enumKeys">
      <xsd:selector xpath="./refs/enumRef"/>
      <xsd:field xpath="."/>
    </xsd:keyref>
  </xsd:element>

<xsd:element name="defns" type="defnsType"/>
  <xsd:element name="enumDef" type="enumDefType"/>
  <xsd:element name="refs" type="refsType"/>
  <xsd:element name="enumRef" type="enumRefType"/>
  
<xsd:complexType name="defnsType">
    <xsd:sequence>
      <xsd:element ref="enumDef"/>
    </xsd:sequence>
  </xsd:complexType>
  

  <xsd:complexType name="enumDefType">
    <xsd:simpleContent>
      <xsd:extension base="enumType">
<xsd:attribute name="key" type="xsd:string"/>
      </xsd:extension>
    </xsd:simpleContent>
  </xsd:complexType>
  
<xsd:simpleType name="enumRefType">
    <xsd:restriction base="enumType"/>
  </xsd:simpleType>
  
<xsd:simpleType name="enumType">
    <xsd:restriction base="xsd:token">
      <xsd:enumeration value="enum1"/>
      <xsd:enumeration value="enum2"/>
    </xsd:restriction>
  </xsd:simpleType>
  
<xsd:complexType name="refsType">
    <xsd:sequence>
      <xsd:element ref="enumRef"/>
    </xsd:sequence>
  </xsd:complexType>
  
</xsd:schema>

