ZVON > Tutorials > XML Schema and Relax NG Tutorial |
Intro / Search / ZVON |
Index | >> Example 3 / 3 << | Prev | Next | |
The schema is not correct, because we have forbidden all further derivations of all types. 3.14.2 (non-normative) XML Representation of Simple Type Definition Schema Components .
Incorrect XML Schema (incorrect_0.xsd) <xsd:schema finalDefault="#all" xmlns:xsd="http://www.w3.org/2001/XMLSchema" > <xsd:element name="root" type="AAA"/> <xsd:simpleType name="AAA"> <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> |
The schema is not correct, because we have forbidden all further restrictions of all types. 3.14.2 (non-normative) XML Representation of Simple Type Definition Schema Components .
Incorrect XML Schema (incorrect_0.xsd) <xsd:schema finalDefault="restriction" xmlns:xsd="http://www.w3.org/2001/XMLSchema" > <xsd:element name="root" type="AAA"/> <xsd:simpleType name="AAA"> <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> |
The schema is correct, because we have forbidden all further extensions of all types, but restrictions are allowed. 3.14.2 (non-normative) XML Representation of Simple Type Definition Schema Components .
Valid document <root xsi:noNamespaceSchemaLocation="correct_0.xsd" xmlns="" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" >10</root> |
Correct XML Schema (correct_0.xsd) <xsd:schema finalDefault="extension" xmlns:xsd="http://www.w3.org/2001/XMLSchema" > <xsd:element name="root" type="AAA"/> <xsd:simpleType name="AAA"> <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> |