- From: Jeff Lowery <jlowery@scenicsoft.com>
- Date: Fri, 18 May 2001 10:01:28 -0700
- To: "'Mike_Leditschke@nemmco.com.au'" <Mike_Leditschke@nemmco.com.au>, xmlschema-dev@w3.org
Don't confuse element substitution with type substitution. The reason to use xsi:type in a document is indicate that the default element type (the one defined for the element in the schema) has be 'substituted' with a derived type. A substitution group allows one element to be substituted for another, so long at the types are the same or the substituted element's is a derived type. The xsi:type isn't necessary, becuase the defualt type for the substituted element is in use. It is possible to combine element substitution with type substitution: substitute an element, then substitute its type with a derived type. I hope that's not too confusing of an explanation (and it may even be substantially correct). Jeff > -----Original Message----- > From: Mike_Leditschke@nemmco.com.au > [mailto:Mike_Leditschke@nemmco.com.au] > Sent: Friday, May 18, 2001 9:36 AM > To: xmlschema-dev@w3.org > Subject: 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 13:02:17 UTC