- From: Henry S. Thompson <ht@cogsci.ed.ac.uk>
- Date: 05 Apr 2001 17:34:13 +0100
- To: "Michael Zoratti" <m.zoratti@nortelnetworks.com>
- Cc: "'www-xml-schema-comments@w3.org'" <www-xml-schema-comments@w3.org>
Your recommended approach isn't actually allowed by XML Schema. The type definition of elements in a substitution group must be derived from the type definition of their head. You have two options I can see: 1) Make the enumeration in the core schema an open enumeration, using union: <simpleType name="OrderState"> <union> <simpleType> <restriction base="string"> <enumeration value="open"/> <enumeration value="open.not_running"/> . . . </restriction> </simpleType> <simpleType> <restriction base="string"/> </simpleType> </union> </simpleType> This has the disadvantage of not (in XML Schema 1.0) allowing explicit restriction by schemas which want to add only specified additions to the enumeration. 2) Take your suggestion and use substitution groups: <complexType name="OrderState"> <sequence> <element ref="OrderState"/> </sequence> </complexType> <element name="OrderState" abstract="true" type="empty"/> <element name="open" substitutionGroup="OrderState"/> <element name="open.not_running" substitutionGroup="OrderState"/> . . . In haste, 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 Thursday, 5 April 2001 12:34:10 UTC