W3C home > Mailing lists > Public > xmlschema-dev@w3.org > March 2003

Re: Block attribute on a complex type

From: Jeni Tennison <jeni@jenitennison.com>
Date: Wed, 19 Mar 2003 13:15:55 +0000
Message-ID: <107953798309.20030319131555@jenitennison.com>
To: "Tim Kimber" <KIMBERT@uk.ibm.com>
CC: xmlschema-dev@w3.org

Hi Tim,

> I'm trying to tie down exactly what the 'block' attribute should do
> when it appears on a complex type.
>
> XML Schema supports two methods of substitution, which I refer to as
> 'type substitution' and 'element substitution'.
> - Type substitution uses the xsi:type attribute to substitute the
> type of the element in the instance document.
> - Element substitution uses substitution groups to substitute the
> element in the instance document.
>
> I believe that 'block' should affect both type substitution and
> element substitution, whether it appears on the element declaration,
> or on the element's complex type.

I suspect that it depends on where you draw the line between "type
substitution" and "element substitution". The block attribute affects
element substitution only in so far as it affects type substitution.
For example, if you had:

<xs:element name="foo" type="fooType" />
<xs:element name="bar" type="fooType" substitutionGroup="foo" />

then you'd be able to substitute the <bar> element for the <foo>
element no matter what the {prohibited substitutions} on the fooType.

On the other hand, if you had:

<xs:element name="foo" type="fooType" />
<xs:element name="bar" type="barType" substitutionGroup="foo" />

where barType is derived from fooType by restriction, then you would
only be able to substitute a <bar> element for a <foo> element if the
{prohibited substitutions} of the fooType did not include
'restriction'.

This compares with the block attribute on element declarations (the
{disallowed substitutions}), which can block all element substitutions
(using 'substitution') as well as type substitutions (whether these
arise due to element substitutions or xsi:type).

Cheers,

Jeni

---
Jeni Tennison
http://www.jenitennison.com/
Received on Wednesday, 19 March 2003 08:16:08 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 11 January 2011 00:14:36 GMT