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

Re: Key and keyref in XSD

From: Eddie Robertsson <eddie@allette.com.au>
Date: Fri, 30 Mar 2001 09:59:00 +1000
Message-ID: <3AC3CC44.E795F1E5@allette.com.au>
To: Henry Thompson <ht@interactive.co.uk>
CC: xmlschema-dev@w3.org
> Your path is Participants/Participant
>
> Your instance appears to have Participants/Name

Thanks Henry, I really need to check my schemas better. However, I'm
still experiencing some strange results. It seems as though XSV only
checks the first child element for key constraints. Is this one of the
things not implemented?
For example the instance:
.....
 <Participants nbrParticipants="2">
  <Name id="p1">Nick</Name>
  <Name id="p2">Marcus</Name>
 </Participants>
 <Teams nbrTeams="2">
  <Team id="t1" Name="Team 1">
   <Member>p1</Member>
   <Member>p2</Member>
  </Team>
 </Teams>
......

validates without errors which is correct. The instance:
.....
 <Participants nbrParticipants="2">
  <Name id="p1">Nick</Name>
  <Name id="p2">Marcus</Name>
 </Participants>
 <Teams nbrTeams="2">
  <Team id="t1" Name="Team 1">
   <Member>p3</Member>
   <Member>p2</Member>
  </Team>
 </Teams>
......

give me the error:

"http://www.allette.com.au/Demo/XSV/Test/Tournament.xml:11:3: Invalid
per cvc-identity-constraint.2.3.2: no key in key_Participant for p3"

which is also correct. However, the instance:
.....
 <Participants nbrParticipants="2">
  <Name id="p1">Nick</Name>
  <Name id="p2">Marcus</Name>
 </Participants>
 <Teams nbrTeams="2">
  <Team id="t1" Name="Team 1">
   <Member>p1</Member>
   <Member>p3</Member>
  </Team>
 </Teams>
......

does not give me an error although the Member p3 is a reference to a
non-existing participant. So, it seems that XSV only checks the first
child element Member within each Team.

Cheers,
/Eddie

[1] http://www.allette.com.au/Demo/XSV/Test/Tournament.xml
[2] http://www.allette.com.au/Demo/XSV/Test/Tournament.xsd
Received on Thursday, 29 March 2001 18:58:31 GMT

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