RE: (Summary) Implementation Experience: INCORRECT usage of xsi:type in Union Types

At 2000-12-11 06:36, Asir S Vedamuthu wrote:

 > [3] On June 26th, 2000, one of the special task force teams
 > presented IG with a proposal for "Adding simple type definitions by
 > union to XML Schema"

 > http://lists.w3.org/Archives/Member/w3c-xml-schema-ig/2000Jun/
 > att-0330/01-union-design.html

 > But, this proposal does not say anything about the current usage of
 > xsi:type in union types. Hence, WG was not aware of this when it
 > decided to accept it. This is a badly formed feature that parachuted
 > into the spec.

The minutes of our August 2000 meeting in Redmond show (sec. 3.5.1)
that the WG explicitly discussed the use of xsi:type to discriminate
among member types, before voting on the union types proposal.

   http://www.w3.org/XML/Group/2000/08/xml-schema-ftf-2000-08-minutes#75956832

So I think we must infer that the WG was after all aware of the idea,
and accepted it.  Certainly I for one was aware of it; I was pleased
to know that authors could use xsi:type to coerce a value to a
particular member type.

I do think we might do well to change the way this is described in the
spec: it seems to me that instead of saying

   (1) that the value of xsi:type (the 'local type definition')
       must be validly derived from the declared type definition, as we
       do in item 2.3 of the validation rule Element Locally Valid
       (Element) and in item 1.1.2.1.3 of validation rule
       Schema-Validity Assessment (Element), and
   (2) that a member type M is validly derived from a union type U
       of which M is a member, as is currently done in the constraint
       on schemas "Type Derivation OK (Simple)",

it might be better to say (in Element Locally Valid (Element) 2.3 and
in Schema-Validity Assessment (Element) that either (a) the local type
definition (value of xsi:type) must be validly derived from the
declared type, or else (b) the declared type definition must be a
union type and the local type must be a member (or a member of a
member, or ...) of that union, or derived from such a member, and omit
the special clause about members of union types from the definition of
'validly derived' (which does seem awfully ad hoc).

This would allow us to restrict the predicate 'U is validly derived
from T' to the transitive closure on the 'base' property on the
component for U, which is intuitively a lot more obvious.  Saying that
a member type is validly derived from its union seems unnecessarily ad
hoc (or perhaps I just think it's an ad hoc rule in the wrong
location).

-CMSMcQ

Received on Wednesday, 27 December 2000 14:01:37 UTC