Re: XML Query Comments to XML Schema (1st part)

Matthew Fuchs wrote:

> Ashok,
>
> I would say that neither approach is ideal and both suffer from the
> type/element distinction.  I would argue that a far better resolution would
> be:
>
> <authors>
>   <simpleAuthor>Serge Abiteboul</simpleAuthor>
>   <complexAuthor><first>Dan</first><last>Sucia</last>
> </authors>
>
> And since both simpleAuthor and complexAuthor subclass from abstactAuthor,
> they're both allowable there.

Just to try and explain the WG's design decision:

The above approach is not ideal either - it suffers from
*lack* of a type/element distinction!

(a) directly within the XML world - it means that, as with
element equivalence classes, the variability of element names
along a path means that an XPath, whether in an XPointer
or in XSLT, has to be aware of all the potential uses of
derived types and probably use wildcards in those positions.

(b) indirectly in relating to other type systems, which have
generally ensured that their paths remain valid even when subclass instances
are encountered along the path, by keeping
type information out of the path. So the naming structures and
paths would look needlessly different from those systems,
whereas xsi:type allows those structures and paths to
correspond directly.

So XML Schema allows xsi:type for the robust path approach
with fixed element names, and element equivalence classes
for substitutable element names (which you could choose to
be those of their types if you like).  For orthogonality,
widely praised as a virtue, it is even possible to combine
the two, and mark a substituted element with xsi:type because
it is carrying an instance derived from its declared type -
although I'm not sure many people would find that desirable.

Thanks,

  David

Received on Friday, 19 May 2000 16:17:14 UTC