ZVON > Tutorials > XML Schema and Relax NG Tutorial |
Intro / Search / ZVON |
Index | >> Example 3 / 8 << | Prev | Next | |
When restrictions are made, the types must be mapped correctly. Roughly said, we cannot declare element "x" to be a string and then declare it as an "integer" in the restriction. Schema Component Constraint: Particle Derivation OK (All:All,Sequence:Sequence - Recurse), 2. .
Incorrect XML Schema (incorrect_0.xsd) <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" > <xsd:element name="root" type="BBB"/> <xsd:complexType name="AAA"> <xsd:sequence maxOccurs="2"> <xsd:element name="x" type="xsd:string" minOccurs="1" maxOccurs="1"/> </xsd:sequence> </xsd:complexType> <xsd:complexType name="BBB"> <xsd:complexContent> <xsd:restriction base="AAA"> <xsd:sequence maxOccurs="1"> <xsd:element name="x" type="xsd:integer" minOccurs="1" maxOccurs="1"/> </xsd:sequence> </xsd:restriction> </xsd:complexContent> </xsd:complexType> </xsd:schema> |