poi/xmlbeans/test/cases/xbean/compile/som/constraints_added.xsd_

95 lines
3.6 KiB
Plaintext
Raw Normal View History

<?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">
<xsd:element name="root">
<xsd:complexType>
<xsd:sequence>
<xsd:element ref="TestRootElemUniqueConstraint" />
<xsd:element ref="TestRootElemKeyConstraint" />
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<!-- unique Constraint - specifies that the child elem for the UniqueConstraintSubElem1 has to be unique -->
<xsd:element name="TestRootElemUniqueConstraint" type="UniqueConstraintElemType">
<xsd:unique name="uniqueConstraint">
<xsd:selector xpath="*/UniqueConstraintSubElem1"/>
<xsd:field xpath="UniqueConstraintSubElem1Child"/>
</xsd:unique>
</xsd:element>
<!-- key Constraint - specifies the child elem for the KeyConstraintSubElem1 must exist -->
<xsd:element name="TestRootElemKeyConstraint" type="KeyConstraintElemType">
<xsd:key name="keyConstraint">
<xsd:selector xpath="*/KeyConstraintSubElem1"/>
<xsd:field xpath="KeyConstraintSubElem1Child"/>
</xsd:key>
<xsd:keyref name="KeyRefConstraint" refer="keyConstraint">
<xsd:selector xpath="*/KeyConstraintSubElem1" />
<xsd:field xpath="KeyConstraintSubElem1Child2" />
</xsd:keyref>
</xsd:element>
<xsd:complexType name="UniqueConstraintElemType">
<xsd:sequence>
<xsd:element name="UniqueConstraintElem1">
<xsd:complexType>
<xsd:sequence>
<xsd:element ref="UniqueConstraintSubElem1" maxOccurs="unbounded"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="KeyConstraintElemType">
<xsd:sequence>
<xsd:element name="KeyConstraintElem1">
<xsd:complexType>
<xsd:sequence>
<xsd:element ref="KeyConstraintSubElem1" maxOccurs="unbounded"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
<!-- the Unique constraint Sub Elem which has a child elem -->
<xsd:element name="UniqueConstraintSubElem1">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="UniqueConstraintSubElem1Child" type="xsd:integer" maxOccurs="25"></xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<!-- the Key constraint Sub Elem which has a child elem -->
<xsd:element name="KeyConstraintSubElem1">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="KeyConstraintSubElem1Child" type="xsd:string"></xsd:element>
<xsd:element name="KeyConstraintSubElem1Child2" type="xsd:string"></xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:schema>