summaryrefslogtreecommitdiff
path: root/tests/cxx/parser/validation/attribute/test.xsd
blob: 833eb8e7e0bf98398452112109acca126943f7ff (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
<?xml version="1.0"?>
<schema xmlns="http://www.w3.org/2001/XMLSchema" xmlns:t="test" targetNamespace="test">


  <!-- Test optional and required attributes as well as a wildcard. -->
  <complexType name="pass-a">
    <attribute name="a" type="string" use="optional"/>
    <attribute name="b" type="string" use="required"/>
    <anyAttribute namespace="##targetNamespace" processContents="skip"/>
  </complexType>


  <!-- Test that in inheritance attributes are checked before wildcards. -->
  <complexType name="pass-b-base">
    <attribute name="a" type="string"/>
    <anyAttribute namespace="#any" processContents="skip"/>
  </complexType>

  <complexType name="pass-b">
    <complexContent>
      <extension base="t:pass-b-base">
        <attribute name="b" type="string"/>
	<anyAttribute namespace="#any" processContents="skip"/>
      </extension>
    </complexContent>
  </complexType>


  <!-- Test that in inheritance by restriction required attribute is
       checked for even though it is not explicitly mentioned in
       derived. -->
  <complexType name="pass-c-base">
    <attribute name="a" type="string" use="required"/>
    <attribute name="b" type="string" use="optional"/>
  </complexType>

  <complexType name="pass-c">
    <complexContent>
      <restriction base="t:pass-c-base">
        <attribute name="b" type="string" use="required"/>
      </restriction>
    </complexContent>
  </complexType>


  <!-- Test detection of missing required attribute. -->
  <complexType name="fail-base">
    <attribute name="a" type="string" use="optional"/>
  </complexType>

  <complexType name="fail">
    <complexContent>
      <restriction base="t:fail-base">
        <attribute name="a" type="string" use="required"/>
      </restriction>
    </complexContent>
  </complexType>


  <complexType name="type">
    <sequence>
      <element name="pass-a" type="t:pass-a"/>
      <element name="pass-b" type="t:pass-b"/>
      <element name="pass-c" type="t:pass-c"/>
      <element name="fail" type="t:fail"/>
    </sequence>
  </complexType>

  <element name="root" type="t:type"/>

</schema>