<?xml version="1.0" encoding="UTF-8"?>
<!--
 Copyright (c) 2000-2021 Ericsson Telecom AB
 All rights reserved. This program and the accompanying materials
 are made available under the terms of the Eclipse Public License v2.0
 which accompanies this distribution, and is available at
 https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.html

 Contributors:
  Balasko, Jeno
  Raduly, Csaba
-->
<schema  xmlns="http://www.w3.org/2001/XMLSchema"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:ns="www.example.org/groups"
targetNamespace="www.example.org/groups">

<annotation><documentation xml:lang="EN">GROUP DEFINITIONS</documentation></annotation>

<xs:group name="shipAndBill">
  <xs:sequence>
    <xs:element name="shipTo" type="xs:string"/>
    <xs:element name="billTo" type="xs:string"/>
  </xs:sequence>
</xs:group>

<xs:group name="shipOrBill">
  <xs:choice>
    <xs:element name="shipTo" type="xs:string"/>
    <xs:element name="billTo" type="xs:string"/>
  </xs:choice>
</xs:group>

<xs:group name="shipAndBillAll">
  <xs:all>
    <xs:element name="shipTo" type="xs:string"/>
    <xs:element name="billTo" type="xs:string"/>
  </xs:all>
</xs:group>

<xs:group name="storeAndDeliverAll">
  <xs:all>
    <xs:element name="store" type="xs:string"/>
    <xs:element name="deliver" type="xs:string"/>
  </xs:all>
</xs:group>

<annotation><documentation xml:lang="EN">GROUP REFERENCES</documentation></annotation>

<annotation><documentation xml:lang="EN">Groups are lonely child of complexType</documentation></annotation>

<xs:complexType name="LonelySeqGroup">
	<annotation><documentation xml:lang="EN">sequence group</documentation></annotation>
	<xs:group   ref="ns:shipAndBill"/>
</xs:complexType>

<xs:complexType name="LonelySeqGroupOptional">
	<annotation><documentation xml:lang="EN">sequence group</documentation></annotation>
	<xs:group  ref="ns:shipAndBill" minOccurs="0"/>
</xs:complexType>

<xs:complexType name="LonelySeqGroupRecurrence">
	<annotation><documentation xml:lang="EN">sequence group</documentation></annotation>
	<xs:group  ref="ns:shipAndBill" minOccurs="0" maxOccurs="unbounded"/>
</xs:complexType>


<xs:complexType name="LonelyChoGroup">
<annotation><documentation xml:lang="EN">choice group</documentation></annotation>
	<xs:group   ref="ns:shipOrBill"/>
</xs:complexType>

<xs:complexType name="LonelyChoGroupOptional">
<annotation><documentation xml:lang="EN">choice group</documentation></annotation>
	<xs:group   ref="ns:shipOrBill" minOccurs="0"/>
</xs:complexType>

<xs:complexType name="LonelyChoGroupRecurrence">
<annotation><documentation xml:lang="EN">choice group</documentation></annotation>
	<xs:group   ref="ns:shipOrBill" minOccurs="0" maxOccurs="unbounded"/>
</xs:complexType>

<xs:complexType name="LonelyAllGroup">
	<annotation><documentation xml:lang="EN">all group</documentation></annotation>
	<xs:group   ref="ns:shipAndBillAll"/>
</xs:complexType>

<xs:complexType name="TwoAllGroups">
	<annotation><documentation xml:lang="EN">all group</documentation></annotation>
	<xs:group   ref="ns:shipAndBillAll"/>
<!--	<xs:group   ref="ns:storeAndDeliverAll"/> -->
</xs:complexType>

<xs:complexType name="LonelyAllGroupOptional">
	<annotation><documentation xml:lang="EN">all group</documentation></annotation>
	<xs:group   ref="ns:shipAndBillAll" minOccurs="0"/>
</xs:complexType>

<xs:complexType name="LonelyAllGroupRecurrence">
	<annotation><documentation xml:lang="EN">all group</documentation></annotation>
	<xs:group   ref="ns:shipAndBillAll" minOccurs="0" maxOccurs="1"/>
</xs:complexType>


<annotation><documentation xml:lang="EN">GROUP REFERENCE IS CHILD OF SEQUENCE</documentation></annotation>

<annotation><documentation xml:lang="EN">sequence group, lonely nested in sequence</documentation></annotation>

<xs:complexType name="SeqGroupInSequence">
	<xs:sequence>
		<annotation><documentation xml:lang="EN">sequence group</documentation></annotation>
		<xs:group   ref="ns:shipAndBill"/>
	</xs:sequence>
</xs:complexType>

<annotation><documentation xml:lang="EN">sequence group, elements nested in sequence</documentation></annotation>

<xs:complexType name="SeqGroupAndElementsInSequence">
	<xs:sequence>
		<annotation><documentation xml:lang="EN">sequence group</documentation></annotation>
		<xs:group   ref="ns:shipAndBill"/>
		<xs:element name="singleUSAddress" type="xs:string"/>
		<xs:element name="comment" minOccurs="0" type="xs:string"/>
		<xs:element name="items"  type="xs:string"/>
	</xs:sequence>
</xs:complexType>

<xs:complexType name="ElementsAndSeqGroupInSequence">
	<xs:sequence>
		<annotation><documentation xml:lang="EN">sequence group</documentation></annotation>
		<xs:element name="singleUSAddress" type="xs:string"/>
		<xs:element name="comment" minOccurs="0" type="xs:string"/>
		<xs:element name="items"  type="xs:string"/>
		<xs:group   ref="ns:shipAndBill"/>
	</xs:sequence>
</xs:complexType>

<xs:complexType name="SeqGroupAndElementsAndAttributeInSequence">
	<xs:sequence>
		<annotation><documentation xml:lang="EN">sequence group</documentation></annotation>
		<xs:group   ref="ns:shipAndBill"/>
		<xs:element name="singleUSAddress" type="xs:string"/>
		<xs:element name="comment" minOccurs="0" type="xs:string"/>
		<xs:element name="items"  type="xs:string"/>
	</xs:sequence>
	<xs:attribute name="orderDate" type="xs:date"/>
</xs:complexType>


<annotation><documentation xml:lang="EN">sequence group, elements and attributes nested in choice</documentation></annotation>

<xs:complexType name="SeqGroupAndElementsAndAttributeInChoice">
	<xs:choice>
		<annotation><documentation xml:lang="EN">sequence group</documentation></annotation>
		<xs:group   ref="ns:shipAndBill"/>
		<xs:element name="singleUSAddress" type="xs:string"/>
		<xs:element name="comment" minOccurs="0" type="xs:string"/>
		<xs:element name="items"  type="xs:string"/>
	</xs:choice>
	<xs:attribute name="orderDate" type="xs:date"/>
</xs:complexType>

<annotation><documentation xml:lang="EN">choice group, elements and attributes nested in choice</documentation></annotation>

<xs:complexType name="ChoGroupAndElementsAndAttributeInSequence">
	<xs:sequence>
		<xs:group   ref="ns:shipOrBill"/>
		<xs:element name="singleUSAddress" type="xs:string"/>
		<xs:element name="comment" minOccurs="0" type="xs:string"/>
		<xs:element name="items"  type="xs:string"/>
	</xs:sequence>
	<xs:attribute name="orderDate" type="xs:date"/>
</xs:complexType>

<xs:complexType name="ChoGroupAndElementsAndAttributeInChoice">
	<xs:choice>
		<xs:group   ref="ns:shipOrBill"/>
		<xs:element name="singleUSAddress" type="xs:string"/>
		<xs:element name="comment" minOccurs="0" type="xs:string"/>
		<xs:element name="items"  type="xs:string"/>
	</xs:choice>
	<xs:attribute name="orderDate" type="xs:date"/>
</xs:complexType>

<xs:complexType name="ChoGroupAndElementsInChoice">
	<xs:choice>
		<xs:group   ref="ns:shipOrBill"/>
		<xs:element name="singleUSAddress" type="xs:string"/>
		<xs:element name="comment" minOccurs="0" type="xs:string"/>
		<xs:element name="items"  type="xs:string"/>
	</xs:choice>
</xs:complexType>

<xs:complexType name="ElementsAndAttributeInSequence">
	<xs:sequence>
		<xs:element name="singleUSAddress" type="xs:string"/>
		<xs:element name="comment" minOccurs="0" type="xs:string"/>
		<xs:element name="items"  type="xs:string"/>
	</xs:sequence>
	<xs:attribute name="orderDate" type="xs:date"/>
</xs:complexType>

<xs:complexType name="ElementsAndAttributeInChoice">
	<xs:choice>
		<xs:element name="singleUSAddress" type="xs:string"/>
		<xs:element name="comment" minOccurs="0" type="xs:string"/>
		<xs:element name="items"  type="xs:string"/>
	</xs:choice>
	<xs:attribute name="orderDate" type="xs:date"/>
</xs:complexType>

<xs:complexType name="SeqGroupInNestedChoiceElementsAndAttributeInSequence">
	<xs:sequence>
		<xs:choice>
			<xs:group   ref="ns:shipAndBill"/>
			<xs:element name="singleUSAddress" type="xs:string"/>
		</xs:choice>
		<xs:element name="comment" minOccurs="0" type="xs:string"/>
		<xs:element name="items"  type="xs:string"/>
	</xs:sequence>
	<xs:attribute name="orderDate" type="xs:date"/>
</xs:complexType>

<xs:complexType name="ChoGroupInNestedChoiceElementsAndAttributeInSequence">
	<xs:sequence>
		<xs:choice>
			<xs:group   ref="ns:shipOrBill"/>
			<xs:element name="singleUSAddress" type="xs:string"/>
		</xs:choice>
		<xs:element name="comment" minOccurs="0" type="xs:string"/>
		<xs:element name="items"  type="xs:string"/>
	</xs:sequence>
	<xs:attribute name="orderDate" type="xs:date"/>
</xs:complexType>


</schema>

