CR-50 response: IDREF and Union Types

Dear Jane,

The W3C XML Schema Working Group has spent the last several weeks
working through the comments received from the public on the
Candidate Recommendation (CR) of the XML Schema specification. We
thank you for the comments you made on our specification during
our CR comment period, and want to make sure you know that all
comments received during the CR comment period have been recorded
in our CR issues list (http://www.w3.org/2000/12/xmlschema-crcomments.html).

You raised the point registered as issue CR-50: IDREF and Union Types.

In a related issue, CR-14, we determined that the value space of IDREF is
the set of all valid names (i.e. strings that match the NCName production),
and that the constraint that IDREFs must match a corresponding ID will no
longer be a condition of type validity.  It will continue to be described
separately as a constraint.

Therefore, to use your example:

   <simpleType name="referenceType">
     <union memberTypes="IDREF uriReference mpeg7:xPathType"/>
   </simpleType>

The schema processor checks the member types in the order in which they
appear in the definition until a match is found, _based on type validity_.
If the schema processor gets a value of "foo", it will be considered an
IDREF (because it is a valid name), whether it matches an ID or not.  If it
then finds that it does not match an ID, it will raise an error.

A consequence is that no uriReferences or xPathTypes may be used that are
also valid names (e.g. "bar"), because they will be determined to be an
IDREF and the processor will raise an error (unless a corresponding ID
happens to exist.)

Changing the order that IDREF appears in the memberTypes list would help get
around this, but then the IDREF constraint would not be validated ("foo"
would be considered a valid uriReference). If validating this constraint is
important to you, I would recommend using the xsi:type attribute in the
instance document to indicate which type it is intended to match. For
example,

	<reference xsi:type="IDREF">foo</reference>

It would be helpful to us to know whether you are satisfied with the
decision taken by the WG on this issue, or wish your dissent from the
WG's decision to be recorded for consideration by the Director of
the W3C.


Regards,

Priscilla Walmsley
XML Schema Working Group

Received on Tuesday, 23 January 2001 17:48:14 UTC