W3C home > Mailing lists > Public > www-xml-schema-comments@w3.org > April to June 2001

Re: Extension of Enumerations

From: Henry S. Thompson <ht@cogsci.ed.ac.uk>
Date: 20 Jun 2001 22:51:40 +0100
To: "Michael Zoratti" <m.zoratti@nortelnetworks.com>
Cc: "'www-xml-schema-comments@w3.org'" <www-xml-schema-comments@w3.org>
Message-ID: <f5bwv666cr7.fsf@cogsci.ed.ac.uk>
"Michael Zoratti" <m.zoratti@nortelnetworks.com> writes:

>   I have posted in the past, a workaround (using substitution groups) that
> provided
> a possible solution to the problem of extensions of Enumerations.
> 
> http://lists.w3.org/Archives/Public/www-xml-schema-comments/2001AprJun/0022.
> html
> 
> Note: Extensions of Enumeration is currently not supported in the
> current definition in XML Schema Language.
> 
> Below I have provided another possibility which is a much more cleaner and
> more strongly typed solution.  I would like any feedback specifically
> whether
> this proposed solution violates the XML Schema Language definition.
> 
> 	First you wrap your standard Enumeration declaration in a Complex
> Type
> 
> 	1)    <complexType name="OrderState">
> 			<sequence>
> 				<element name="Value"
> type="en:OrderStateEnum" nullable="true"/>
> 			</sequence>
> 		  </complexType>
> 
> 	        Note: OrderStateEnum is your standard simpleType
> enumeration.
> 
> 
> 	Second if you want to add to this base set of enumerations you first
> declare a complexType
> 	which extends from OrderState, the derivation is by Restriction.
> Derivation by Restriction
> 	allows you to modify the parent complexType declarations, and in
> affect change the type of the Value element.
> 	The Value element of this complexType will be of type
> OrderStateEnumExtended. Therefore in
> 	XML instance documents you could either (using xsi:type) refer to
> OrderState, or OrderStateExtended and the
> 	sets of enumerations will be different. The structure and the
> element names ;however, would be
> 	same.
> 
> 	2)  <complexType name="OrderStateExtended">
> 		<complexContent>
> 			<restriction base="en:OrderState">
> 				<sequence>
> 				     <element name="Value"
> type="en:OrderStateEnumExtended"/>

        ********not allowed******
> 				</sequence>
> 			</restriction>
> 		</complexContent>
> 	</complexType>

This wrapper approach doesn't solve your problem  -- the above type is 
not allowed, because the types of elements in restricted types must be 
restrictions (or the same as) their corresponding types in the base
type, but OrderStateEnumExtended is not derived from OrderStateEnum.

ht
-- 
  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 Wednesday, 20 June 2001 17:51:40 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Sunday, 6 December 2009 18:12:50 GMT