[XMLSCHEMA-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Derivation by restriction wrt to type inheritance

From: Martin Bernauer <bernauer@dke.uni-linz.ac.at>
Date: Wed, 21 Nov 2001 10:45:51 +0100
Message-ID: <003e01c17271$52cd4620$ca3a4e8c@dkepc3>
To: <xmlschema-dev@w3.org>
Derivation by restriction wrt to type inheritance
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 GMT

Subscribe to the Stylus Scoop newsletter for helpful XML tips and tutorials.
Email
First Name
Last Name
Company

Download Stylus Studio 6 XML Enterprise Edition

Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2007 All Rights Reserved.