[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] question about restrictions
I have a question regarding the following schema: <?xml version="1.0" encoding="UTF-8"?> <xsd:schema targetNamespace="urn:example" xmlns="urn:example" xmlns:xsd="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="unqualified"> <xsd:element name="Root" type="RestrictedType"/> <xsd:complexType name="RestrictedType"> <xsd:complexContent> <xsd:restriction base="BaseType"> <xsd:sequence> <xsd:element name="FirstElement"> <xsd:complexType> <xsd:choice> <xsd:element name="FirstChoice" type="xsd:string" maxOccurs="unbounded"/> <xsd:element name="SecondChoice" type="xsd:string" maxOccurs="unbounded"/> </xsd:choice> </xsd:complexType> </xsd:element> <xsd:element name="SecondElement" type="xsd:string" minOccurs="0" maxOccurs="unbounded"/> </xsd:sequence> </xsd:restriction> </xsd:complexContent> </xsd:complexType> <xsd:complexType name="BaseType"> <xsd:sequence> <xsd:element name="FirstElement"> <xsd:complexType> <xsd:choice> <xsd:element name="FirstChoice" type="xsd:string" maxOccurs="unbounded"/> <xsd:element name="SecondChoice" type="xsd:string" maxOccurs="unbounded"/> </xsd:choice> </xsd:complexType> </xsd:element> <xsd:element name="SecondElement" type="xsd:string" minOccurs="0" maxOccurs="unbounded"/> </xsd:sequence> </xsd:complexType> </xsd:schema> When I try validating a simple XML document using Xerces with full schema checking enabled, I get the following error message: Error for type 'RestrictedType'. The particle of the type is not a valid restriction of the particle of the base. Through the process of elimination, I've determined the trouble lies in FirstElement found in the two types. I've looked at the schema contraints at http://www.w3.org/TR/xmlschema-1/#derivation-ok-restriction that I believe govern this issue. With reading those and since, FirstElement is a verbatium copy from BaseType to RestrictedType I've been unable to determine the cause for the invalid restriction message. Can someone give me some insight into the cause of the violation? Thanks, Brent Worden
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|