summaryrefslogtreecommitdiff
path: root/xsd/tests/schema/enumeration/test.xsd
blob: b8253d9480904f1211accc3441749dce24595e73 (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
<?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">

  <!-- string-based -->

  <xsd:simpleType name="StringEnum">
    <xsd:restriction base="xsd:string">
      <xsd:enumeration value="one"/>
      <xsd:enumeration value="two"/>
      <xsd:enumeration value="three"/>
    </xsd:restriction>
  </xsd:simpleType>

  <xsd:simpleType name="StringSimple">
    <xsd:restriction base="xsd:string"/>
  </xsd:simpleType>  

  <!-- inheritance of a enum from a simple type -->
  <xsd:simpleType name="StringSimpleRestriction">
    <xsd:restriction base="test:StringSimple">
      <xsd:enumeration value="one"/>
      <xsd:enumeration value="two"/>
    </xsd:restriction>
  </xsd:simpleType>

  <!-- inheritance of a enum from a strig-based enum -->
  <xsd:simpleType name="StringEnumRestriction">
    <xsd:restriction base="test:StringEnum">
      <xsd:enumeration value="one"/>
      <xsd:enumeration value="two"/>
    </xsd:restriction>
  </xsd:simpleType>

  <!-- inheritance of a complex type from a string-based enum -->
  <xsd:complexType name="StringComplex">
    <xsd:simpleContent>
      <xsd:extension base="test:StringEnumRestriction">
        <xsd:attribute name="lang" type="xsd:language"/>
      </xsd:extension>
    </xsd:simpleContent>
  </xsd:complexType>



  <!-- non string-based -->

  <xsd:simpleType name="IntEnum">
    <xsd:restriction base="xsd:int">
      <xsd:enumeration value="1"/>
      <xsd:enumeration value="2"/>
      <xsd:enumeration value="3"/>
    </xsd:restriction>
  </xsd:simpleType>

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

  <!-- inheritance of a enum from a simple type -->
  <xsd:simpleType name="IntSimpleRestriction">
    <xsd:restriction base="test:IntSimple">
      <xsd:enumeration value="1"/>
      <xsd:enumeration value="2"/>
    </xsd:restriction>
  </xsd:simpleType>

  <!-- inheritance of a enum from a enum -->
  <xsd:simpleType name="IntEnumRestriction">
    <xsd:restriction base="test:IntEnum">
      <xsd:enumeration value="1"/>
      <xsd:enumeration value="2"/>
    </xsd:restriction>
  </xsd:simpleType>

  <!-- inheritance of a complex type from a enum -->
  <xsd:complexType name="IntComplex">
    <xsd:simpleContent>
      <xsd:extension base="test:IntEnumRestriction">
        <xsd:attribute name="lang" type="xsd:language"/>
      </xsd:extension>
    </xsd:simpleContent>
  </xsd:complexType>


</xsd:schema>