- From: Martin Bernauer <bernauer@dke.uni-linz.ac.at>
- Date: Wed, 21 Nov 2001 10:45:51 +0100
- To: <xmlschema-dev@w3.org>
Concerning derivation by restriction most samples are 'easy' samples restricting complex types, e.g. by changing number of allowed occurences, or simple types. My question now is the following: Is it allowed to change the type of an element "b" declared at complex type "B", when deriving a new complex type "R" from "B" by restriction, and setting the type of "b" to a subtype of its former type? Or more concrete by the means of an example: I define complex types Person and a complex type Staff (a subtype of Person), furthermore a complex type for a list of persons, PersonList. I now want to derive a new complex type StaffList from PersonList, restricting the type of its only element "entry" from Person to Staff. For me this is definitely a derivation by restriction, nevertheless IBMs schema quality checker rejects it, and I suppose XML Spy has limitations concerning derivation by restrictions (it accepts the schema below). <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="qualified" targetNamespace="http://sample.org" xmlns:sam="http://sample.org"> <xs:complexType name="Person"> <xs:sequence> <xs:element name="name"/> </xs:sequence> </xs:complexType> <xs:complexType name="Staff"> <xs:complexContent> <xs:extension base="sam:Person"> <xs:sequence> <xs:element name="ssnr"/> <xs:element name="address"/> </xs:sequence> </xs:extension> </xs:complexContent> </xs:complexType> <xs:complexType name="PersonList"> <xs:sequence> <xs:element name="entry" type="sam:Person"/> </xs:sequence> </xs:complexType> <xs:complexType name="StaffList"> <xs:complexContent> <xs:restriction base="sam:PersonList"> <xs:sequence> <xs:element name="entry" type="sam:Staff"/> </xs:sequence> </xs:restriction> </xs:complexContent> </xs:complexType> </xs:schema> Regards, Martin I scanned the archives, but couldn't find messages to this topic. Sorry if it had been asked before.
Received on Wednesday, 21 November 2001 04:44:31 UTC