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

keyref with empty sets

From: Nigel Hardy <nwh@aber.ac.uk>
Date: Fri, 28 May 2004 11:21:49 +0100
Message-ID: <40B712BD.6050309@aber.ac.uk>
To: xmlschema-dev@w3.org
I have the following snippet of schema:

  <xs:element name="Admin">

    <xs:complexType mixed="false">


        <xs:element ref="UserSet"      minOccurs="0" maxOccurs="1"/>

        <xs:element ref="ExperimentSet" minOccurs="0" maxOccurs="1"/>



    <xs:keyref name="ExperimentAssocRef" refer="UserKey">

      <xs:selector xpath="ad:ExperimentSet/ad:Experiment"/>

      <xs:field xpath="ad:userID"/>

      <!-- the implementation of ResponsibleFor -->



All experiments must have a user responsible for them. We can have a set 
of users with no associated experiments, but I also want the possibility 
of having an empty Admin element. UserKey is defined over the elements 
of UserSet.

When I set up a test with no experimentSet (but some users in the 
userSet) that's fine.

With a completely empty Admin element I am told there is a "keyref which 
refers to a key or unique that is out of scope" (using Java Xerces).

So I see that when there were just users there were values of UserKey 
but no Experiment happened to refer to them. I had not expected that 
when there were no users either I would have a problem that there were 
no users for experiments not to reference :-)

Where am I adrift?


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 06:13:36 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 7 January 2015 14:56:05 UTC