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

Re: multiple field unique definitions problem

From: Eddie Robertsson <erobertsson@allette.com.au>
Date: Wed, 27 Mar 2002 10:11:20 +1100
Message-ID: <3CA10018.884ED871@allette.com.au>
To: "Zbyszynski, Marc" <mzbyszynski@doubleclick.net>
CC: "'xmlschema-dev@w3.org'" <xmlschema-dev@w3.org>
Hi Marc,

> That section describes implementing this unique constraint:
>
> <unique name="dummy1">
>  <selector xpath="r:regions/r:zip"/>
>  <field xpath="@code"/>
>  <field xpath="r:part/@number"/>
> </unique>
>
> against the following document:
>
> <purchaseReport
>   xmlns="http://www.example.com/Report"
>   period="P3M" periodEnding="1999-12-31">
>
>  <regions>
>   <zip code="95819">
>    <part number="872-AA" quantity="1"/>
>    <part number="926-AA" quantity="1"/>
>    <part number="833-AA" quantity="1"/>
>    <part number="455-BX" quantity="1"/>
>   </zip>
>   <zip code="63143">
>    <part number="455-BX" quantity="4"/>
>   </zip>
>  </regions>
>
>  <parts>
>   <part number="872-AA">Lawnmower</part>
>   <part number="926-AA">Baby Monitor</part>
>   <part number="833-AA">Lapis Necklace</part>
>   <part number="455-BX">Sturdy Shelves</part>
>  </parts>
>
> </purchaseReport>
>
> However, when I try to validate this instance of the report schema as
> described in the primer using XSV, I get an error stating "Field XPath ...
> Produced Multiple hits".
>
> My question is, is this an error in the primer or in XSV? Is it possible to
> define unique constraints globally this way? Attached is a simpler example
> (tester.xsd and tester.xml). Thanks for your help!

This example is in fact wrong and XSV is correct in reporting an error. For
more information on this see the post starting with [1].

Cheers,
/Eddie

[1] http://lists.w3.org/Archives/Public/xmlschema-dev/2001Jun/0103.html
Received on Tuesday, 26 March 2002 17:59:00 GMT

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