- From: Henry S. Thompson <ht@cogsci.ed.ac.uk>
- Date: 22 Jun 2001 16:42:38 +0100
- To: "Michael Zoratti" <m.zoratti@nortelnetworks.com>
- Cc: "'xmlschema-dev@w3.org'" <xmlschema-dev@w3.org>, "'www-xml-schema-comments@w3.org'" <www-xml-schema-comments@w3.org>
"Michael Zoratti" <m.zoratti@nortelnetworks.com> writes: > Scenario #1 > > 1) Wrap the enumeration declaration in a base complexType. Simply provide > the > element name (Value in this example) but do not provide the type > declaration. > 2) In the extension you can declare the Value element and provide the > declaration of > the simple type enumeration > 3) Any consequent extension you could declare the Value element of a > different enumerated type. > > 1) <complexType name="OrderStateBase" abstract="true"> > <sequence> > <element name="Value"/> > </sequence> > </complexType> > > 2) <complexType name="OrderState"> > <complexContent> > <restriction base="en:OrderStateBase"> > <sequence> > <element name="Value" > type="en:OrderStateEnum"/> > </sequence> > </restriction> > </complexContent> > </complexType> > > 3) <complexType name="OrderStateExtended"> > <complexContent> > <restriction base="en:OrderStateBase"> > <sequence> > <element name="Value" > type="en:OrderStateEnumExtended"/> > </sequence> > </restriction> > </complexContent> > </complexType> That works, but OrderStateExtended has no relationship to OrderState. > Scenario #2 > > 1) Wrap the enumeration element declaration in a base complexType. Provide > the > element name (Value in this example) and the simple type enumeration > declaration. > 2) Introduce OrderStateRestricted that does not re-declare the > the Value element. > 3)Then declare a OrderStateExtended (extended from OrderStateRestricted) > that declares a Value element of a different simple type enumeration. > > 1) <complexType name="OrderState"> > <sequence> > <element name="Value" type="en:OrderStateEnum" > nullable="true"/> > </sequence> > </complexType> > > > 2) <complexType name="OrderStateRestricted"> > <annotation> > <documentation>By not re-declaring the original > element Value, it is in effect Omitted.</documentation> > </annotation> > <complexContent> > <restriction base="en:OrderState"> > <sequence/> > </restriction> > </complexContent> > </complexType> > > 3) <complexType name="OrderStateExtended"> > <annotation> > <documentation>We extend from OrderStateRestricted, > which has no elements in it but is still extended > from OrderState and therefore allowed to replace any > occurrence of OrderState</documentation> > </annotation> > <complexContent> > <extension base="en:OrderStateRestricted"> > <sequence> > <element name="Value" > type="en:OrderStateEnumExtended"/> > </sequence> > </extension> > </complexContent> > </complexType> That doesn't work, because there is explicit language (clause 1.5 of [1] which forbids you from using extension to put back something you took away: "It must in principle be possible to derive the complex type definition in two steps, the first an extension and the second a restriction (possibly vacuous), from that type definition among its ancestors whose {base type definition} is the ·ur-type definition·." ht [1] http://www.w3.org/TR/xmlschema-1/#cos-ct-extends) -- Henry S. Thompson, HCRC Language Technology Group, University of Edinburgh W3C Fellow 1999--2001, part-time member of W3C Team 2 Buccleuch Place, Edinburgh EH8 9LW, SCOTLAND -- (44) 131 650-4440 Fax: (44) 131 650-4587, e-mail: ht@cogsci.ed.ac.uk URL: http://www.ltg.ed.ac.uk/~ht/
Received on Friday, 22 June 2001 11:42:39 UTC