aboutsummaryrefslogtreecommitdiff
path: root/tests/schema/enumeration.testscript
blob: 5313611283b7060d2f9d06bdb2ca2dfa5b834194 (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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
# file      : tests/schema/enumeration.testscript
# license   : GNU GPL v2 + exceptions; see accompanying LICENSE file

test.options += --enum-synthesis

: synthesis
:
{
  cat <<EOI >=test.xsd;
    <?xml version="1.0"?>
    <schema xmlns="http://www.w3.org/2001/XMLSchema" xmlns:t="test" targetNamespace="test">

      <!-- Enumeration synthesis -->

      <simpleType name="common-base">
        <restriction base="string"/>
      </simpleType>

      <simpleType name="base">
        <restriction base="t:common-base"/>
      </simpleType>

      <simpleType name="one">
        <restriction base="t:base">
          <enumeration value="romance">
            <annotation>
              <documentation>romance documentation</documentation>
            </annotation>
          </enumeration>
          <enumeration value="fiction"/>
          <enumeration value="horror"/>
        </restriction>
      </simpleType>

      <simpleType name="two">
        <restriction base="t:common-base">
          <enumeration value="horror"/>
          <enumeration value="history"/>
          <enumeration value="philosophy"/>
        </restriction>
      </simpleType>

      <simpleType name="three">
        <restriction base="anyURI">
          <enumeration value="foo"/>
          <enumeration value="bar"/>
        </restriction>
      </simpleType>

      <simpleType name="union0">
        <union memberTypes="t:one t:two t:union1"/>
      </simpleType>

      <simpleType name="union1">
        <annotation>
          <documentation>union1 documentation</documentation>
        </annotation>
        <union memberTypes="t:one t:two"/>
      </simpleType>

      <simpleType name="union2">
        <union memberTypes="t:one t:union1 t:common-base"/>
      </simpleType>

      <simpleType name="union3">
        <union memberTypes="t:one t:three"/>
      </simpleType>

      <complexType name="complex1">
        <sequence>
          <element name="a" type="t:union1"/>
        </sequence>
      </complexType>

      <complexType name="complex2">
        <simpleContent>
          <extension base="t:union1"/>
        </simpleContent>
      </complexType>

    </schema>
    EOI

  $* test.xsd >>EOO
    primary
    {
      namespace test
      {
        complex common-base: http://www.w3.org/2001/XMLSchema#string
        {
        }
        complex base: test#common-base
        {
        }
        enumeration one: test#base
        {
          <romance documentation>
          enumerator romance
          enumerator fiction
          enumerator horror
        }
        enumeration two: test#common-base
        {
          enumerator horror
          enumerator history
          enumerator philosophy
        }
        enumeration three: http://www.w3.org/2001/XMLSchema#anyURI
        {
          enumerator foo
          enumerator bar
        }
        enumeration union0: test#common-base
        {
          <romance documentation>
          enumerator romance
          enumerator fiction
          enumerator horror
          enumerator history
          enumerator philosophy
        }
        <union1 documentation>
        enumeration union1: test#common-base
        {
          <romance documentation>
          enumerator romance
          enumerator fiction
          enumerator horror
          enumerator history
          enumerator philosophy
        }
        union union2 test#one test#union1 test#common-base
        union union3 test#one test#three
        complex complex1
        {
          element a
          [1, 1] sequence
          {
            [1, 1] element a test#union1
          }
        }
        complex complex2: test#union1
        {
        }
      }
    }
    EOO
}