W3C home > Mailing lists > Public > xmlschema-dev@w3.org > June 2002

Re: Substitution Group

From: Jeni Tennison <jeni@jenitennison.com>
Date: Wed, 26 Jun 2002 10:00:28 +0100
Message-ID: <132248461598.20020626100028@jenitennison.com>
To: "Eoin Shanaghy" <eoinshanaghy@iol.ie>
CC: xmlschema-dev@w3.org

Hi Eoin,

> It seems that the extension for "sub" has to be the same type as
> "base", but how did I extend the anonymous complexType??

I see you're trying to confuse us by using 'xs' as the prefix for your
target namespace :)

You can't extend anonymous complex types, so you have to give them a
name, for example 'baseType':

<element name="base" type="xs:baseType" />
<complexType name="baseType" />

Then you can explicitly extend the baseType to provide the type for
the sub element:

<element name="sub" substitutionGroup="xs:base">
      <extension base="xs:baseType">
          <element name="subAttr" />

Note: I think that you might run into problems if you try to use an
'all' model group in your extension, because when you derive a type by
extension you effectively create a sequence of the base and extended
model groups, and 'all' model groups can't appear within sequences.
That's not a problem because you've only got one element in the above
anyway, but I guess it might be in your real situation. If so, I
suggest you look at making the base element be of type xs:anyType and
have the sub element's type be derived by restriction rather than



Jeni Tennison
Received on Wednesday, 26 June 2002 05:00:29 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 7 January 2015 14:55:57 UTC