| <?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" |
| xmlns="http://xbean/scomp/derivation/GroupRestriction" |
| targetNamespace="http://xbean/scomp/derivation/GroupRestriction" |
| xmlns:base="http://xbean/scomp/contentType/ModelGroup" |
| > |
| <xsd:import namespace="http://xbean/scomp/contentType/ModelGroup" |
| schemaLocation="../contentType/Group.xsd"/> |
| |
| |
| <xsd:complexType name="restrictedSequenceT"> |
| <xsd:complexContent> |
| <xsd:restriction base="base:SequenceT"> |
| <xsd:sequence> |
| <xsd:element name="child1" type="xsd:integer" minOccurs="1"/> |
| <xsd:element name="child3" type="xsd:integer" minOccurs="1" |
| maxOccurs="2"/> |
| </xsd:sequence> |
| </xsd:restriction> |
| </xsd:complexContent> |
| </xsd:complexType> |
| |
| <!--elts must be a subset of the original choice group--> |
| <xsd:complexType name="restrictedChoiceT"> |
| <xsd:complexContent> |
| <xsd:restriction base="base:ChoiceT"> |
| <xsd:choice> |
| <xsd:element name="child3" type="xsd:integer" minOccurs="1" |
| maxOccurs="2"/> |
| </xsd:choice> |
| </xsd:restriction> |
| </xsd:complexContent> |
| </xsd:complexType> |
| |
| <xsd:complexType name="restrictedAllT"> |
| <xsd:complexContent> |
| <xsd:restriction base="base:AllT"> |
| <xsd:all> |
| <xsd:element name="child2" type="xsd:string" maxOccurs="1"/> |
| <xsd:element name="child3" type="xsd:integer" minOccurs="1"/> |
| </xsd:all> |
| </xsd:restriction> |
| </xsd:complexContent> |
| </xsd:complexType> |
| |
| <!--examples from Walmsley book p. 327--> |
| <xsd:complexType name="replaceableChoiceT"> |
| <xsd:choice maxOccurs="2"> |
| <xsd:element name="a" type="xsd:string"/> |
| <xsd:element name="b" type="xsd:string"/> |
| <xsd:element name="c" type="xsd:int"/> |
| </xsd:choice> |
| </xsd:complexType> |
| |
| |
| |
| <xsd:complexType name="replaceableAllT"> |
| <xsd:all> |
| <xsd:element name="a" type="xsd:string" minOccurs="1"/> |
| <xsd:element name="b" type="xsd:string" minOccurs="0"/> |
| <xsd:element name="c" type="xsd:int"/> |
| </xsd:all> |
| </xsd:complexType> |
| |
| <!--replace All group with sequence group--> |
| <xsd:complexType name="All2SequenceT"> |
| <xsd:complexContent> |
| <xsd:restriction base="replaceableAllT"> |
| <xsd:sequence> |
| <xsd:element name="a" type="xsd:string"/> |
| <xsd:element name="c" type="xsd:int"/> |
| </xsd:sequence> |
| </xsd:restriction> |
| </xsd:complexContent> |
| </xsd:complexType> |
| <!--replace choice group with sequence group--> |
| <xsd:complexType name="Choice2SequenceT"> |
| <xsd:complexContent> |
| <xsd:restriction base="replaceableChoiceT"> |
| <xsd:sequence> |
| <xsd:element name="a" type="xsd:string"/> |
| <xsd:element name="c" type="xsd:int"/> |
| </xsd:sequence> |
| </xsd:restriction> |
| </xsd:complexContent> |
| </xsd:complexType> |
| |
| <xsd:element name="RestrictedSequenceElt" type="restrictedSequenceT"/> |
| <xsd:element name="RestrictedChoiceElt" type="restrictedChoiceT"/> |
| <xsd:element name="RestrictedAllElt" type="restrictedAllT"/> |
| <xsd:element name="Choice2SeqElt" type="Choice2SequenceT"/> |
| <xsd:element name="All2SeqElt" type="All2SequenceT"/> |
| |
| |
| </xsd:schema> |