<?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"
    xmlns:ng="http://ws.apache.org/jaxme/test/nestedGroups"
    xmlns:jaxb="http://java.sun.com/xml/ns/jaxb"
    xml:lang="EN"
    targetNamespace="http://ws.apache.org/jaxme/test/nestedGroups"
    elementFormDefault="qualified"
    attributeFormDefault="unqualified"
    jaxb:version="1.0">
  <xs:annotation><xs:documentation>
      This schema is for testing various kinds of nested groups.
  </xs:documentation></xs:annotation>

  <xs:group name="abGroup">
    <xs:sequence>
      <xs:element name="a" type="xs:string"/>
      <xs:element name="b" type="xs:int"/>
    </xs:sequence>
  </xs:group>

  <xs:group name="cdGroup">
    <xs:sequence>
      <xs:element name="c" type="xs:string"/>
      <xs:element name="d" type="xs:int"/>
    </xs:sequence>
  </xs:group>

  <xs:element name="SequenceOfSimpleSequences">
    <xs:annotation><xs:documentation>
      This is the most basic kind of nested group: A sequence, which is
      made of two sequences, each of which has a multiplicity &lt;= 1.

	  However, this example isn't as unimportant as it may seem, because
	  this is in fact, how xs:extension is solved internally.
    </xs:documentation></xs:annotation>
    <xs:complexType>
      <xs:sequence>
        <xs:group ref="ng:abGroup"/>
        <xs:group ref="ng:cdGroup"/>
      </xs:sequence>
    </xs:complexType>
  </xs:element>

  <xs:element name="MixedElement">
    <xs:annotation><xs:documentation>
      This is an extended type of nested groups: The outer element
      contains child elements with mixed content.
    </xs:documentation></xs:annotation>
    <xs:complexType mixed="true">
      <xs:sequence>
        <xs:element name="f" type="xs:float">
          <xs:annotation><xs:appinfo>
            <jaxb:property name="aFloat"/>
          </xs:appinfo></xs:annotation>
        </xs:element>
        <xs:choice>
          <xs:element name="g" type="xs:long"/>
          <xs:element name="h" type="xs:dateTime"/>
        </xs:choice>
        <xs:element name="abElement">
          <xs:complexType>
            <xs:group ref="ng:abGroup"/>
          </xs:complexType>
        </xs:element>
        <xs:group ref="ng:abGroup"/>
        <xs:element name="cdElement">
          <xs:complexType>
            <xs:group ref="ng:cdGroup"/>
          </xs:complexType>
        </xs:element>
        <xs:group ref="ng:cdGroup"/>
      </xs:sequence>
    </xs:complexType>
  </xs:element>

  <xs:element name="ThreeNestedLevelsElement">
    <xs:annotation><xs:documentation>
      An element with three levels of nested groups.
    </xs:documentation></xs:annotation>
    <xs:complexType>
      <xs:sequence>
        <xs:choice>
          <xs:sequence>
            <xs:element name="a" type="xs:string"/>
            <xs:element name="b" type="xs:int" minOccurs="0" maxOccurs="unbounded"/>
          </xs:sequence>
          <xs:sequence>
            <xs:element name="c" type="xs:string"/>
            <xs:element name="d" type="xs:int" minOccurs="0"/>
          </xs:sequence>
          <xs:sequence>
            <xs:element name="e" type="xs:string" minOccurs="0"/>
            <xs:element name="f" type="xs:int"/>
          </xs:sequence>
          <xs:sequence>
            <xs:element name="g" type="xs:string" minOccurs="0"/>
          </xs:sequence>
        </xs:choice>
        <xs:element name="h" type="xs:long" minOccurs="0"/>
      </xs:sequence>
    </xs:complexType>
  </xs:element>

	<xs:group name="MailTemplateGroup">
		<xs:sequence>
			<xs:element name="subject" type="xs:string"/>
			<xs:choice>
				<xs:sequence>
					<xs:element name="prepend" type="xs:string"/>
					<xs:element name="append" type="xs:string"/>
				</xs:sequence>
				<xs:element name="body" maxOccurs="unbounded">
					<xs:complexType>
						<xs:simpleContent>
							<xs:extension base="xs:string">
								<xs:attribute name="delivery" use="required">
									<xs:simpleType>
										<xs:restriction base="xs:string">
											<xs:enumeration value="dailyDigest"/>
											<xs:enumeration value="immediate"/>
										</xs:restriction>
									</xs:simpleType>
								</xs:attribute>
							</xs:extension>
						</xs:simpleContent>
					</xs:complexType>
				</xs:element>
			</xs:choice>
		</xs:sequence>
	</xs:group>

	<xs:element name="MailTemplate">
		<xs:annotation>
			<xs:documentation>Mail template sample</xs:documentation>
		</xs:annotation>
		<xs:complexType>
			<xs:group ref="ng:MailTemplateGroup"/>
			<xs:attribute name="language" type="xs:string" use="optional" default="EN"/>
			<xs:attribute name="name" type="xs:string" use="required"/>
		</xs:complexType>
	</xs:element>

	<xs:element name="MailTemplateMixed">
		<xs:annotation>
			<xs:documentation>Mail template sample with mixed content</xs:documentation>
		</xs:annotation>
		<xs:complexType mixed="true">
			<xs:group ref="ng:MailTemplateGroup"/>
			<xs:attribute name="language" type="xs:string" use="optional" default="EN"/>
			<xs:attribute name="name" type="xs:string" use="required"/>
		</xs:complexType>
	</xs:element>


  <xs:complexType name="PathComponent">
    <xs:attribute name="name" type="xs:string" use="required" />
    <xs:attribute name="status" type="xs:int" use="optional"/>
  </xs:complexType>

  <xs:complexType name="Container">
    <xs:sequence>
      <xs:element name="container" type="ng:PathComponent" />
    </xs:sequence>
  </xs:complexType>

  <xs:complexType name="DocumentType">
    <xs:complexContent>
      <xs:extension base="ng:Container">
        <xs:sequence>
          <xs:element name="documentType" type="ng:PathComponent" />
        </xs:sequence>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>

  <xs:complexType name="Document">
    <xs:complexContent>
      <xs:extension base="ng:DocumentType">
        <xs:sequence>
          <xs:element name="document" type="ng:PathComponent" />
        </xs:sequence>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>

  <xs:complexType name="Version">
    <xs:complexContent>
      <xs:extension base="ng:Document">
        <xs:sequence>
          <xs:element name="version" type="ng:PathComponent" />
        </xs:sequence>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>

  <xs:element name="Ver" type="ng:Version"/>
</xs:schema>
