Substitution groups and xsi:type

In section 4.6 of the primer, two statements are made...

1. "Elements in a substitution group must have the same
type as the head element, or they can have a type that has been
derived from the head element's type"

then later

2. "..when an instance document contains element substitutions
whose types are derived from those of their head elements, it is
not necessary to identify the derived types using the xsi:type
construction..."


I think the wording of the second is tripping me up a bit given
that, assuming the first statement, I can't see how you'd
ever get a case where the second didn't apply, that is,

an instance document containing element substitutions, whose
types WEREN'T derived from those of the head etc and hence
who WOULD have to use the xsi:type attribute.

Is the intent to say, if you use an element substitution, the rules about
providing xsi:type attributes in instance documents don't apply?



On a similar vein, it appears that for substitution groups to work,
validators are capable of working
out "for themselves" which particular substitution group element has
been provided in an instance document without the instance author
explicitly telling the validator.

It seems a small step to ask why then, I need to provide xsi:type
attributes at all, given that the validator knows the set of types that
could possbily be used i.e. those derived from the base type used
in the schema defining the instance document.

What additional "magic" is enabled by explictly tying a series of
related elements (and by implication types) together via
substitutionGroup attribute



I've probably gone off the road completely somewhere. A pointer to
the skid marks would be appreciated.

Regards
Michael

Received on Friday, 18 May 2001 12:36:11 UTC