aboutsummaryrefslogtreecommitdiff
path: root/tests/schema/union.testscript
blob: 3294ee8ef412f0ebe4dd5cc822a22fff71739149 (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
# file      : tests/schema/union.testscript
# license   : GNU GPL v2 + exceptions; see accompanying LICENSE file

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

      <simpleType name="u1">
        <union memberTypes="int string"/>
      </simpleType>

      <simpleType name="u2">
        <union>
          <simpleType>
            <restriction base="token">
              <enumeration value="one"/>
            </restriction>
          </simpleType>
          <simpleType>
            <restriction base="string">
              <enumeration value="two"/>
            </restriction>
          </simpleType>
        </union>
      </simpleType>

      <simpleType name="u3">
        <union memberTypes="  int

    t:u1 ">
          <simpleType>
            <restriction base="token">
              <enumeration value="one"/>
            </restriction>
          </simpleType>
          <simpleType>
            <restriction base="string">
              <enumeration value="two"/>
            </restriction>
          </simpleType>
        </union>
      </simpleType>

    </schema>
    EOI

  $* test.xsd >>EOO
    primary
    {
      namespace test
      {
        union u1 http://www.w3.org/2001/XMLSchema#int http://www.w3.org/2001/XMLSchema#string
        union u2
        {
          enumeration <anonymous>: http://www.w3.org/2001/XMLSchema#token
          {
            enumerator one
          }
        }

        {
          enumeration <anonymous>: http://www.w3.org/2001/XMLSchema#string
          {
            enumerator two
          }
        }

        union u3 http://www.w3.org/2001/XMLSchema#int test#u1
        {
          enumeration <anonymous>: http://www.w3.org/2001/XMLSchema#token
          {
            enumerator one
          }
        }

        {
          enumeration <anonymous>: http://www.w3.org/2001/XMLSchema#string
          {
            enumerator two
          }
        }

      }
    }
    EOO
}

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

      <!-- Test resolution of anonymous argument types. -->

      <simpleType name="list">
        <list>
          <simpleType>
            <union memberTypes="int t:enum"/>
          </simpleType>
        </list>
      </simpleType>

      <simpleType name="enum">
        <restriction base="string">
          <enumeration value="male"/>
          <enumeration value="female"/>
        </restriction>
      </simpleType>

    </schema>
    EOI

  $* test.xsd >>EOO
    primary
    {
      namespace test
      {
        list list
        {
          union <anonymous> http://www.w3.org/2001/XMLSchema#int test#enum
        }
        enumeration enum: http://www.w3.org/2001/XMLSchema#string
        {
          enumerator male
          enumerator female
        }
      }
    }
    EOO
}