summaryrefslogtreecommitdiff
path: root/tests/cxx/parser/validation/restriction/test.xsd
blob: 158ded5a5b8321aec5daa260e46f8c861974b397 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
<?xml version="1.0"?>
<schema xmlns="http://www.w3.org/2001/XMLSchema" xmlns:t="test" targetNamespace="test">

  <!-- simple case -->
  <complexType name="base-a">
    <sequence minOccurs="1" maxOccurs="2">
      <element name="a" type="string" minOccurs="0"/>
      <element name="b" type="string"/>
      <element name="c" type="string"/>
    </sequence>
    <attribute name="x" type="string"/>
    <attribute name="y" type="string"/>
    <attribute name="z" type="string"/>
  </complexType>

  <complexType name="restriction-a">
    <complexContent>
      <restriction base="t:base-a">
        <sequence minOccurs="1" maxOccurs="1">
          <element name="a" type="string" minOccurs="1"/>
          <element name="b" type="string"/>
          <element name="c" type="string"/>
        </sequence>
	<!-- Can be ommited if not changed, e.g., 'x'. -->
	<attribute name="y" type="string"/> <!-- But can also be repeated without change. -->
        <attribute name="z" type="string" use="required"/>
      </restriction>
    </complexContent>
  </complexType>

  <!-- restriction of an extension -->
  <complexType name="base-b">
    <sequence>
      <element name="a" type="string" minOccurs="0"/>
    </sequence>
    <attribute name="x" type="string"/>
  </complexType>

  <complexType name="extension-b">
    <complexContent>
      <extension base="t:base-b">
        <choice>
          <element name="b" type="string" minOccurs="0"/>
          <element name="c" type="string"/>
        </choice>
        <attribute name="y" type="string"/>
      </extension>
    </complexContent>
  </complexType>

  <complexType name="restriction-b">
    <complexContent>
      <restriction base="t:extension-b">
        <sequence>
	  <sequence>
            <element name="a" type="string" minOccurs="1"/>
          </sequence>
	  <choice>
            <element name="b" type="string" minOccurs="0"/>
            <element name="c" type="string"/>
          </choice>
	</sequence>
        <attribute name="y" type="string" use="required"/>
      </restriction>
    </complexContent>
  </complexType>

  <complexType name="type-b">
    <choice maxOccurs="unbounded">
      <element name="restriction-a" type="t:base-a"/>
      <element name="restriction-b" type="t:extension-b"/>
    </choice>
  </complexType>

  <complexType name="type-r">
    <choice maxOccurs="unbounded">
      <element name="restriction-a" type="t:restriction-a"/>
      <element name="restriction-b" type="t:restriction-b"/>
    </choice>
  </complexType>

</schema>