ZVON > Tutorials > XML Schema and Relax NG Tutorial
Index | >> Example 2 / 3 << | Prev | Next |
Contents > Final > XML Schema - no more extensions allowed

XML Schema - no more extensions allowed

  1. Incorrect schema
XML Schema keys: final, extension

1. Incorrect schema

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

Incorrect XML Schema (incorrect_0.xsd)


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

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

  <xsd:complexType name="AAA" final="extension">
    <xsd:simpleContent>
      <xsd:extension base="xsd:string"/>
    </xsd:simpleContent>
  </xsd:complexType>

  <xsd:complexType name="BBB">
    <xsd:simpleContent>
      <xsd:extension base="AAA">
        <xsd:attribute name="X"/>
      </xsd:extension>
    </xsd:simpleContent>
  </xsd:complexType>
</xsd:schema>