summaryrefslogtreecommitdiffstats
path: root/libxml2/test/schemas/bug303566_1.xsd
blob: fee99f7b9653a22ceef3b4310c6a705ebaa94dfc (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
<?xml version="1.0"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">

  <xsd:simpleType name="codeType">
    <xsd:restriction base="xsd:string">
      <xsd:pattern value="[A-Z]+"/>
    </xsd:restriction>
  </xsd:simpleType>

  <xsd:element name="Test">
    <xsd:complexType>
      <xsd:sequence>
        <xsd:element ref="Country"
                     maxOccurs="unbounded"/>
      </xsd:sequence>
    </xsd:complexType>
  </xsd:element>

  <xsd:element name="Country">
    <xsd:complexType>
      <xsd:sequence>
        <xsd:element ref="City"
                     maxOccurs="unbounded"/>
      </xsd:sequence>
      <xsd:attribute name="code"
                     type="codeType"
                     use="required"/>
    </xsd:complexType>
    <xsd:key name="CountryDummyKey">
      <xsd:selector xpath="."/>
      <xsd:field xpath="@code"/>
    </xsd:key>
    <xsd:keyref name="PartRefCountryDummy"
      refer="CountryDummyKey">
      <xsd:selector xpath=".//Part"/>
      <xsd:field xpath="@country"/>
    </xsd:keyref>
  </xsd:element>

  <xsd:element name="City">
    <xsd:complexType>
      <xsd:sequence>
        <xsd:element ref="Part"
                     minOccurs="2"
                     maxOccurs="2"/>
      </xsd:sequence>
      <xsd:attribute name="name"
                     type="xsd:string"
                     use="required"/>
      <xsd:attribute name="code"
                     type="xsd:string"
                     use="required"/>
    </xsd:complexType>
  </xsd:element>

  <xsd:element name="Part">
    <xsd:complexType>
      <xsd:attribute name="country"
                    type="codeType"
                    use="required"/>
    </xsd:complexType>
  </xsd:element>
</xsd:schema>