summaryrefslogtreecommitdiff
path: root/tests/schema/union/test.xsd
blob: 706f6f23fda010fdc8a4fb703ba33c7ba7a88d84 (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
<?xml version="1.0" ?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
            xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
            xsi:schemaLocation="http://www.w3.org/2001/XMLSchema XMLSchema.xsd"
	    xmlns:test="http://www.codesynthesis.com/xmlns/test"
            targetNamespace="http://www.codesynthesis.com/xmlns/test">

  <xsd:simpleType name="IntUnion">
    <xsd:union memberTypes="xsd:int xsd:string"/>
  </xsd:simpleType>

  <!-- local element with anonymous union inside. -->

  <xsd:complexType name="Foo">
    <xsd:sequence>
      <xsd:element name="string-union">
        <xsd:simpleType>
	  <xsd:union memberTypes="xsd:int xsd:string"/>
        </xsd:simpleType>
      </xsd:element>
    </xsd:sequence>
  </xsd:complexType>


  <!-- global element with anonymous union inside. -->

  <xsd:element name="string-union">
    <xsd:simpleType>
      <xsd:union memberTypes="xsd:int xsd:string"/>
    </xsd:simpleType>
  </xsd:element>



  <!-- global element and global union with conflicting names -->

  <xsd:simpleType name="long-union">
    <xsd:union memberTypes="xsd:long xsd:string"/>
  </xsd:simpleType>

  <xsd:element name="long-union" type="test:long-union"/>


  <!-- forward reference -->

  <xsd:simpleType name="int-union">
    <xsd:union memberTypes="test:int xsd:string"/>
  </xsd:simpleType>

  <xsd:simpleType name="int">
    <xsd:restriction base="xsd:int"/>
  </xsd:simpleType>


  <!-- inheritance from union -->

  <xsd:complexType name="IntComplex">
    <xsd:simpleContent>
      <xsd:extension base="test:IntUnion">
        <xsd:attribute name="foo" type="xsd:string"/>
      </xsd:extension>
    </xsd:simpleContent>
  </xsd:complexType>

</xsd:schema>