poi/xmlbeans/samples/SubstitutionGroup/schemas/EasyPo.xsd
2018-02-16 22:41:27 +00:00

92 lines
3.3 KiB
XML

<!--
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.
-->
<xs:schema targetNamespace="http://xmlbeans.apache.org/samples/substitutiongroup/easypo"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:po="http://xmlbeans.apache.org/samples/substitutiongroup/easypo"
elementFormDefault="qualified" >
<xs:element name="purchase-order">
<xs:complexType>
<xs:sequence>
<xs:element ref="po:invoice-header" minOccurs="1" maxOccurs="unbounded" />
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="invoice-header">
<xs:complexType>
<xs:sequence>
<xs:element name="ship-to" type="po:name-address" />
<xs:element name="bill-to" type="po:name-address" />
<xs:element ref="po:product" minOccurs="0" />
<xs:element ref="po:comment" minOccurs="0" />
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:complexType name="name-address">
<xs:sequence>
<xs:element name="name" type="xs:string" />
<xs:element name="address" type="xs:string" />
</xs:sequence>
</xs:complexType>
<xs:complexType name="product-type" abstract="true">
<xs:attribute name="id" type="xs:int" />
</xs:complexType>
<xs:complexType name="book-type">
<xs:complexContent>
<xs:extension base="po:product-type">
<xs:sequence>
<xs:element name="title" type="xs:string" />
</xs:sequence>
</xs:extension>
</xs:complexContent>
</xs:complexType>
<xs:complexType name="clothing-type">
<xs:complexContent>
<xs:extension base="po:product-type">
<xs:sequence>
<xs:element name="color">
<xs:simpleType>
<xs:restriction base="xs:token">
<xs:enumeration value="red"/>
<xs:enumeration value="blue"/>
<xs:enumeration value="green"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
</xs:sequence>
</xs:extension>
</xs:complexContent>
</xs:complexType>
<xs:element name="product" type="po:product-type" abstract="true"/>
<xs:element name="book" type="po:book-type"
substitutionGroup="po:product"/>
<xs:element name="clothing" type="po:clothing-type"
substitutionGroup="po:product"/>
<xs:element name="comment" type="xs:string" />
<xs:element name="ship-comment" type="xs:string" substitutionGroup="po:comment" />
<xs:element name="bill-comment" type="xs:string" substitutionGroup="po:comment" />
</xs:schema>