ZVON > Tutorials > XML Schema and Relax NG Tutorial
Index | >> Example 1 / 3 << | Prev | Next |
Contents > Final > XML Schema - no more restrictions of a simpleType allowed

XML Schema - no more restrictions of a simpleType allowed

  1. Incorrect schema
XML Schema keys: final, restriction

1. Incorrect schema

The schema is not correct, because we have forbidden further restrictions based on type "AAA" and the type "BBB" violates this requirement. Schema Component Constraint: Derivation Valid (Restriction, Simple); .

Incorrect XML Schema (incorrect_0.xsd)


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

  <xsd:element name="root" type="AAA"/>

  <xsd:simpleType name="AAA" final="restriction">
    <xsd:restriction base="xsd:integer">
      <xsd:minInclusive value="0"/>
    </xsd:restriction>
  </xsd:simpleType>

  <xsd:simpleType name="BBB">
    <xsd:restriction base="AAA">
      <xsd:minInclusive value="10"/>
    </xsd:restriction>
  </xsd:simpleType>
</xsd:schema>