- From: Eddie Robertsson <eddie@allette.com.au>
- Date: Thu, 29 Mar 2001 12:38:05 +1000
- To: XSD <xmlschema-dev@w3.org>
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="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="Tournament.xsd"> <Name>Allette Open</Name> <Type>Singles</Type> <Date>2000-02-20</Date> <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> </Team> <Team id="t2" Name="Team 2"> <Member>p2</Member> </Team> </Teams> <Matches nbrMatches="1"> <Match id="m1"> <Team>t1</Team> <Team>t2</Team> </Match> </Matches> </Tournament> 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:key> <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> </xsd:element> ... 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 "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 p1 http://www.allette.com.au/Demo/XSV/Test/Tournament.xml:14:3: 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) 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 Wednesday, 28 March 2001 21:36:37 UTC