W3C home > Mailing lists > Public > xmlschema-dev@w3.org > April 2001

Re: Key and keyref in XSD

From: Henry S. Thompson <ht@cogsci.ed.ac.uk>
Date: 12 Apr 2001 11:36:00 +0100
To: Eddie Robertsson <eddie@allette.com.au>
Cc: xmlschema-dev@w3.org
Message-ID: <f5b1yqymmlr.fsf@cogsci.ed.ac.uk>
You should have gotten an error, but not the one you expected.

Your definition:

  <xsd:keyref name="ref_Participant" refer="key_Participant">
   <!-- Make sure that the value of each Member
        element in the Team elements is an identifier for an existing
        Participant -->
     <xsd:selector xpath="Teams/Team"/>
     <xsd:field xpath="Member"/>
  </xsd:keyref>

says that each _Team_ refers to a Participant via its Member daughter.
That's not what you meant, and it should give an error since the field 
XPath produces multiple fields for your instance.  What you meant was

 <xsd:keyref name="ref_Participant" refer="key_Participant">
  <!-- Make sure that the value of each Member
       element in the Team elements is an identifier for an existing
       Participant -->
  <xsd:selector xpath="Teams/Team/Member"/>
  <xsd:field xpath="."/>
 </xsd:keyref>

This gives the error you are expecting from your instance.

I'll look in to the other bug.

ht
-- 
  Henry S. Thompson, HCRC Language Technology Group, University of Edinburgh
          W3C Fellow 1999--2001, part-time member of W3C Team
     2 Buccleuch Place, Edinburgh EH8 9LW, SCOTLAND -- (44) 131 650-4440
	    Fax: (44) 131 650-4587, e-mail: ht@cogsci.ed.ac.uk
		     URL: http://www.ltg.ed.ac.uk/~ht/
Received on Thursday, 12 April 2001 06:36:03 GMT

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