W3C home > Mailing lists > Public > xmlschema-dev@w3.org > May 2004

RE: keyref with empty sets

From: Michael Kay <mhk@mhk.me.uk>
Date: Fri, 28 May 2004 18:11:55 +0100
To: "'Nigel Hardy'" <nwh@aber.ac.uk>, <xmlschema-dev@w3.org>
Message-Id: <20040528171232.A9C34A0766@frink.w3.org>
DIfferent schema processors appear to differ on the validity of either of
these documents.
 
The rules for what happens when the xs:key and the corresponding xs:keyref
are defined on different element declarations are incredibly obscure (so
it's not surprising that implementations differ).
 
My reading is that the element on which the keyref appears (ExperimentSet)
is only valid if it has a "node-table" for the referenced key containing
each value selected by the keyref, and such a node-table will exist only for
the element on which the key is defined (UserSet) and on each of its
ancestors. In other words it only makes sense to define a keyref on either
the same element as the key, or an ancestor of it. The ExperimentSet element
doesn't have a node-table for the UserKey key, and I therefore conclude that
the ExperimentSet in d1.xml is invalid; and MSXML 4.0 appears to agree.
However, Xerces and XSV both say this one is valid, so I may well have the
wrong end of the stick.
 
In fact, I almost certainly have got the wrong end of the stick, because
MSXML, Xerces, and XSV all agree that d2.xml is invalid, and I can't for the
life of me see what is wrong with it. One would certainly think that d2 can
only be invalid if the schema is invalid, and if the schema is invalid then
d1 must fail validation. So I look forward to Henry's answer with eager
anticipation... 
 
(I'm particular intrigued to know what the phrase "which much be understood
as logically prior to this clause of this constraint, below" is supposed to
mean. I don't understand it at all, let alone understanding it as logically
prior to something else, below or otherwise.)
 
As I am implementing a schema processor I'm interested in knowing what the
exact rules are, but my advice to a user would be always to declare the key
and the keyref on the same element, to steer clear of these problems. In
your case this is the Admin element.
 
Michael Kay


  _____  

From: xmlschema-dev-request@w3.org [mailto:xmlschema-dev-request@w3.org] On
Behalf Of Nigel Hardy
Sent: 28 May 2004 13:56
To: xmlschema-dev@w3.org
Subject: Re: keyref with empty sets


Henry S. Thompson wrote:


I _think_ I understand your problem, but a complete schema and an

instance that illustrates the problem would allow me (and others) to

try to replicate. . .



  

Thank you very much. 

*	mod-admin.xsd is the schema 

*	it uses datatypes.xsd so I have added that 

*	d1.xml works (probably you don't need that example therefore) 

*	d2.xml causes the problem 

As you will guess for the filename, admin is only a module of a larger
system, hence the reason for allowing it to be empty.

Nigel

-- 

---------------------------------------------------------------------

Nigel Hardy     Tel: +44 1970 622 434.   http://users.aber.ac.uk/nwh/

  Dept. Computer Sci,  University of Wales, Aberystwyth, SY23 3DB, UK

  Adran Cyfrifiadureg, Prifysgol Cymru,     Aberystwyth, SY23 3DB, UK
Received on Friday, 28 May 2004 13:12:32 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 11 January 2011 00:14:44 GMT