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

Re: Extension of Simple Types

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>
Message-ID: <f5bae5vs3ui.fsf@cogsci.ed.ac.uk>
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
  <simpleType name="OrderState">
     <restriction base="string">
      <enumeration value="open"/>
      <enumeration value="open.not_running"/>
      . . .
     <restriction base="string"/>

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">
     <element ref="OrderState"/>

   <element name="OrderState" abstract="true" type="empty"/>

   <element name="open" substitutionGroup="OrderState"/>
   <element name="open.not_running" substitutionGroup="OrderState"/>

    . . .

In haste,

  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

This archive was generated by hypermail 2.3.1 : Wednesday, 7 January 2015 14:49:56 UTC