Re: Block attribute on a complex type

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 UTC