| 1 |
<?xml version="1.0" encoding="UTF-8"?> |
| 2 |
<!-- Schema test for invalid restricted models: UPA violation restricting a substitution group head. --> |
| 3 |
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"> |
| 4 |
|
| 5 |
<xs:element type="xs:string" name="elem1"/> |
| 6 |
<xs:element type="xs:string" name="elem2" substitutionGroup="elem1" /> |
| 7 |
|
| 8 |
<xs:complexType name="basicType1"> |
| 9 |
<xs:sequence> |
| 10 |
<xs:element ref="elem1" maxOccurs="unbounded"/> |
| 11 |
</xs:sequence> |
| 12 |
</xs:complexType> |
| 13 |
|
| 14 |
<!-- Invalid with XSD 1.0, see: https://www.w3.org/Bugs/Public/show_bug.cgi?id=4147 --> |
| 15 |
<xs:complexType name="restrictedType0"> |
| 16 |
<xs:complexContent> |
| 17 |
<xs:restriction base="basicType1"> |
| 18 |
<xs:sequence> |
| 19 |
<xs:element ref="elem2"/> |
| 20 |
</xs:sequence> |
| 21 |
</xs:restriction> |
| 22 |
</xs:complexContent> |
| 23 |
</xs:complexType> |
| 24 |
|
| 25 |
<!-- UPA violation minOccurs < maxOccurs --> |
| 26 |
<xs:complexType name="restrictedType1"> |
| 27 |
<xs:complexContent> |
| 28 |
<xs:restriction base="basicType1"> |
| 29 |
<xs:sequence> |
| 30 |
<xs:element ref="elem2" maxOccurs="unbounded"/> |
| 31 |
</xs:sequence> |
| 32 |
</xs:restriction> |
| 33 |
</xs:complexContent> |
| 34 |
</xs:complexType> |
| 35 |
|
| 36 |
<!-- No UPA violation if the restricted element is empty but elem2 is not a restriction --> |
| 37 |
<xs:complexType name="restrictedType2"> |
| 38 |
<xs:complexContent> |
| 39 |
<xs:restriction base="basicType1"> |
| 40 |
<xs:sequence> |
| 41 |
<xs:element ref="elem2" minOccurs="0" maxOccurs="0"/> |
| 42 |
</xs:sequence> |
| 43 |
</xs:restriction> |
| 44 |
</xs:complexContent> |
| 45 |
</xs:complexType> |
| 46 |
|
| 47 |
<xs:element type="xs:string" name="elem3" abstract="true"/> |
| 48 |
<xs:element type="xs:string" name="elem4" substitutionGroup="elem3" /> |
| 49 |
|
| 50 |
<xs:complexType name="basicType3"> |
| 51 |
<xs:sequence> |
| 52 |
<xs:element ref="elem3" maxOccurs="unbounded"/> |
| 53 |
</xs:sequence> |
| 54 |
</xs:complexType> |
| 55 |
|
| 56 |
<!-- No UPA violation if the head element is abstract (it cannot be used in an instance). --> |
| 57 |
<xs:complexType name="restrictedType3"> |
| 58 |
<xs:complexContent> |
| 59 |
<xs:restriction base="basicType3"> |
| 60 |
<xs:sequence> |
| 61 |
<xs:element ref="elem4" maxOccurs="unbounded"/> |
| 62 |
</xs:sequence> |
| 63 |
</xs:restriction> |
| 64 |
</xs:complexContent> |
| 65 |
</xs:complexType> |
| 66 |
|
| 67 |
</xs:schema> |