<?xml version="1.0" encoding="UTF-8"?>
<!--
 Copyright 2003, 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.
-->
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
    xml:lang="EN"
    targetNamespace="http://ws.apache.org/jaxme/test/misc/enumeration"
    xmlns:ex="http://ws.apache.org/jaxme/test/misc/enumeration"
    xmlns:jaxb="http://java.sun.com/xml/ns/jaxb"
    xmlns:xjc="http://java.sun.com/xml/ns/jaxb/xjc"
    jaxb:extensionBindingPrefixes="xjc"
    elementFormDefault="qualified"
    attributeFormDefault="unqualified"
    jaxb:version="1.0">
  <xs:annotation>
    <xs:documentation>
      Demonstration of a complex type with all sorts of enumeration values.
    </xs:documentation>
    <xs:appinfo>
      <jaxb:globalBindings
          typesafeEnumBase="xs:string xs:int xs:long xs:short xs:double xs:float">
        <xjc:serializable/>
      </jaxb:globalBindings>
    </xs:appinfo>
  </xs:annotation>

  <!-- In this example the typesafeEnumMember instances are part of the
       typesafeEnumClass. -->
  <xs:simpleType name="StringType">
    <xs:annotation>
      <xs:appinfo>
        <jaxb:typesafeEnumClass name="MyStringTypeClass">
          <jaxb:typesafeEnumMember name="FOO" value="FOO"/>
          <jaxb:typesafeEnumMember name="BAR" value="BAR"/>
        </jaxb:typesafeEnumClass>
      </xs:appinfo>
    </xs:annotation>
    <xs:restriction base="xs:string">
      <xs:enumeration value="FOO"/>
      <xs:enumeration value="BAR"/>
    </xs:restriction>
  </xs:simpleType>

  <!-- Here's another case: The typesafeEnumMember instances are part
       of their respective values. Choose your own style. -->
  <xs:simpleType name="IntType">
    <xs:annotation>
      <xs:appinfo>
        <jaxb:typesafeEnumClass name="MyIntTypeClass"/>
      </xs:appinfo>
    </xs:annotation>
    <xs:restriction base="xs:int">
      <xs:enumeration value="3">
        <xs:annotation>
          <xs:appinfo>
            <jaxb:typesafeEnumMember name="INT3"/>
          </xs:appinfo>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="0">
        <xs:annotation>
          <xs:appinfo>
            <jaxb:typesafeEnumMember name="INT0"/>
          </xs:appinfo>
        </xs:annotation>
      </xs:enumeration>
      <xs:enumeration value="-7">
        <xs:annotation>
          <xs:appinfo>
            <jaxb:typesafeEnumMember name="INT_7"/>
          </xs:appinfo>
        </xs:annotation>
      </xs:enumeration>
    </xs:restriction>
  </xs:simpleType>

  <!-- I personally prefer the former style, for shortness. So we
       revert to this style. -->
  <xs:simpleType name="LongType">
    <xs:annotation>
      <xs:appinfo>
        <jaxb:typesafeEnumClass name="MyLongTypeClass">
          <jaxb:typesafeEnumMember name="LONG_POSITIVE" value="987298379879887"/>
          <jaxb:typesafeEnumMember name="LONG_ZERO" value="0"/>
          <jaxb:typesafeEnumMember name="LONG_NEGATIVE" value="-23987982739273989"/>
        </jaxb:typesafeEnumClass>
      </xs:appinfo>
    </xs:annotation>
    <xs:restriction base="xs:long">
      <xs:enumeration value="987298379879887"/>
      <xs:enumeration value="0"/>
      <xs:enumeration value="-23987982739273989"/>
    </xs:restriction>
  </xs:simpleType>

  <xs:simpleType name="ShortType">
    <xs:annotation>
      <xs:appinfo>
        <jaxb:typesafeEnumClass name="MyShortTypeClass">
          <jaxb:typesafeEnumMember name="SHORT_POSITIVE" value="3468"/>
          <jaxb:typesafeEnumMember name="SHORT_ZERO" value="0"/>
          <jaxb:typesafeEnumMember name="SHORT_NEGATIVE" value="-23"/>
        </jaxb:typesafeEnumClass>
      </xs:appinfo>
    </xs:annotation>
    <xs:restriction base="xs:short">
      <xs:enumeration value="3468"/>
      <xs:enumeration value="0"/>
      <xs:enumeration value="-23"/>
    </xs:restriction>
  </xs:simpleType>

  <xs:simpleType name="DoubleType">
    <xs:annotation>
      <xs:appinfo>
        <jaxb:typesafeEnumClass name="MyDoubleTypeClass">
          <jaxb:typesafeEnumMember name="DOUBLE_POSITIVE" value="3249239847982.234"/>
          <jaxb:typesafeEnumMember name="DOUBLE_ZERO" value="0"/>
          <jaxb:typesafeEnumMember name="DOUBLE_NEGATIVE" value="-324234.234"/>
        </jaxb:typesafeEnumClass>
      </xs:appinfo>
    </xs:annotation>
    <xs:restriction base="xs:double">
      <xs:enumeration value="3249239847982.234"/>
      <xs:enumeration value="0"/>
      <xs:enumeration value="-324234.234"/>
    </xs:restriction>
  </xs:simpleType>

  <xs:simpleType name="FloatType">
    <xs:annotation>
      <xs:appinfo>
        <jaxb:typesafeEnumClass name="MyFloatTypeClass">
          <jaxb:typesafeEnumMember name="FLOAT_POSITIVE" value="47982.234"/>
          <jaxb:typesafeEnumMember name="FLOAT_ZERO" value="0"/>
          <jaxb:typesafeEnumMember name="FLOAT_NEGATIVE" value="-24234.234"/>
        </jaxb:typesafeEnumClass>
      </xs:appinfo>
    </xs:annotation>
    <xs:restriction base="xs:float">
      <xs:enumeration value="47982.234"/>
      <xs:enumeration value="0"/>
      <xs:enumeration value="-24234.234"/>
    </xs:restriction>
  </xs:simpleType>

  <xs:complexType name="AllSimpleTypes">
    <xs:sequence>
      <xs:element name="StringElem" type="ex:StringType"/>
      <xs:element name="IntElem" type="ex:IntType"/>
      <xs:element name="LongElem" type="ex:LongType"/>
      <xs:element name="ShortElem" type="ex:ShortType"/>
      <xs:element name="DoubleElem" type="ex:DoubleType"/>
      <xs:element name="FloatElem" type="ex:FloatType"/>
      <xs:element name="DateTimeElem" minOccurs="0">
        <xs:simpleType>
          <xs:restriction base="xs:dateTime">
            <xs:enumeration value="2002-12-17T12:23:11"/>
            <xs:enumeration value="2002-12-16T12:00:11"/>
          </xs:restriction>
        </xs:simpleType>
      </xs:element>
      <xs:element name="DateElem" minOccurs="0">
        <xs:simpleType>
          <xs:restriction base="xs:date">
            <xs:enumeration value="2002-12-17"/>
            <xs:enumeration value="2002-12-16"/>
          </xs:restriction>
        </xs:simpleType>
      </xs:element>
      <xs:element name="TimeElem" minOccurs="0">
        <xs:simpleType>
          <xs:restriction base="xs:time">
            <xs:enumeration value="12:23:11"/>
            <xs:enumeration value="12:00:11"/>
          </xs:restriction>
        </xs:simpleType>
      </xs:element>
    </xs:sequence>
  </xs:complexType>

  <xs:element name="AllTypesElement">
    <xs:complexType>
      <xs:sequence>
        <xs:element type="ex:AllSimpleTypes" name="AllSimpleTypesElement"/>
      </xs:sequence>
    </xs:complexType>
  </xs:element>

  <xs:element name="LocalEnumElement">
    <xs:complexType>
      <xs:sequence>
        <xs:element name="LocalString">
          <xs:simpleType>
            <xs:annotation><xs:appinfo>
              <jaxb:typesafeEnumClass name="LocalStringCl"/>
            </xs:appinfo></xs:annotation>
            <xs:restriction base="xs:string">
              <xs:enumeration value="a"/>
              <xs:enumeration value="b"/>
            </xs:restriction>
          </xs:simpleType>
        </xs:element>
        <xs:element name="LocalInt">
          <xs:simpleType>
            <xs:restriction base="xs:int">
              <xs:enumeration value="0"/>
              <xs:enumeration value="1"/>
            </xs:restriction>
          </xs:simpleType>
        </xs:element>
        <xs:element name="LocalDouble">
          <xs:simpleType>
            <xs:restriction base="xs:double">
              <xs:enumeration value="0.0"/>
              <xs:enumeration value="1.0"/>
            </xs:restriction>
          </xs:simpleType>
        </xs:element>
      </xs:sequence>
    </xs:complexType>
  </xs:element>

  <xs:element name="LocalEnumAttribute">
    <xs:complexType>
      <xs:attribute name="stringAttr" default="b">
        <xs:simpleType>
          <xs:restriction base="xs:string">
            <xs:enumeration value="a"/>
            <xs:enumeration value="b"/>
          </xs:restriction>
        </xs:simpleType>
      </xs:attribute>
      <xs:attribute name="intAttr">
        <xs:simpleType>
          <xs:restriction base="xs:int">
            <xs:enumeration value="0"/>
            <xs:enumeration value="1"/>
          </xs:restriction>
        </xs:simpleType>
      </xs:attribute>
      <xs:attribute name="doubleAttr">
        <xs:simpleType>
          <xs:restriction base="xs:double">
            <xs:enumeration value="0.0"/>
            <xs:enumeration value="1.0"/>
          </xs:restriction>
        </xs:simpleType>
      </xs:attribute>
    </xs:complexType>
  </xs:element>
</xs:schema>
