- From: Michael Zoratti <m.zoratti@nortelnetworks.com>
- Date: Fri, 22 Jun 2001 10:49:40 -0400
- To: "'xmlschema-dev@w3.org'" <xmlschema-dev@w3.org>, "'www-xml-schema-comments@w3.org'" <www-xml-schema-comments@w3.org>
- Message-ID: <CEDFCAE711ADD4118B030008C7E674A41CA5C6@nbrwd469.ca.nortel.com>
Since XML Schema has no way of dealing with extensions of enumerations we are forced to come up with a work around in dealing with such a poor short coming. Below are two possible work arounds in dealing with extensions. Are these two work arounds, valid and which method would be recommended. 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> 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>
Received on Friday, 22 June 2001 10:50:49 UTC