Key and keyref in XSD

Hi all,

I've been experimenting with key and keyref constructs in XSD lately and
unfortunately I get strange error messages from XSV. I checked the XSV
site and saw that it still doesn't implement XPath fully so maybe that's
the reason I'm getting these errors. My XML instance look like this:

<Tournament xmlns:xsi=""
 <Name>Allette Open</Name>
 <Participants nbrParticipants="2">
  <Name id="p1">Nick</Name>
  <Name id="p2">Marcus</Name>
 <Teams nbrTeams="2">
  <Team id="t1" Name="Team 1">
  <Team id="t2" Name="Team 2">
 <Matches nbrMatches="1">
  <Match id="m1">

The snippet that is important in my schema is:

<xsd:element name="Tournament" type="Tournament">
  <xsd:key name="key_Participant">
   <!-- Make sure that each Participant has a unique id -->
   <xsd:selector xpath="Participants/Participant"/>
   <xsd:field xpath="@id"/>
  <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"/>

Full Instance and schema can be found at [1] and [2] respectively. When
I validate this using XSV I get the following errors:
Problems with the schema-validity of the target

" Invalid
per cvc-identity-constraint.2.3.2: no key in key_Participant for p1 Invalid per
cvc-identity-constraint.2.3.2: no key in key_Participant for p2"

The instance looks valid to me so this leaves me with to options:

1) My key and keyref declarations are wrong
2) This is not yet implemented in XSV (or XML Spy for that matter)



Received on Wednesday, 28 March 2001 21:36:37 UTC