summaryrefslogtreecommitdiff
path: root/xsd/examples/cxx/parser/polymorphism/supermen.xsd
blob: c9029da76c1f68ae71c5711e1322c4160689507e (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
<?xml version="1.0"?>

<!--

file      : examples/cxx/parser/polymorphism/supermen.xsd
copyright : not copyrighted - public domain

-->

<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">

  <xsd:complexType name="person">
    <xsd:sequence>
      <xsd:element name="name" type="xsd:string"/>
    </xsd:sequence>
  </xsd:complexType>

  <!-- substitution group root -->
  <xsd:element name="person" type="person"/>


  <xsd:complexType name="superman">
    <xsd:complexContent>
      <xsd:extension base="person">
        <xsd:attribute name="can-fly" type="xsd:boolean" use="required"/>
      </xsd:extension>
    </xsd:complexContent>
  </xsd:complexType>

  <xsd:element name="superman" type="superman" substitutionGroup="person"/>

  <xsd:complexType name="batman">
    <xsd:complexContent>
      <xsd:extension base="superman">
        <xsd:attribute name="wing-span" type="xsd:unsignedInt" use="required"/>
      </xsd:extension>
    </xsd:complexContent>
  </xsd:complexType>

  <xsd:complexType name="supermen">
    <xsd:sequence>
      <xsd:element ref="person" maxOccurs="unbounded"/>
    </xsd:sequence>
  </xsd:complexType>

  <xsd:element name="supermen" type="supermen"/>

</xsd:schema>