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

multiple field unique definitions problem

From: Zbyszynski, Marc <mzbyszynski@doubleclick.net>
Date: Mon, 25 Mar 2002 17:57:34 -0500 (EST)
Message-ID: <03E81ABDC8C2D31192C9009027D5B86E066FAE85@NYC-EX03>
To: "'xmlschema-dev@w3.org'" <xmlschema-dev@w3.org>
I am trying to implement a multiple key unique constraint as described in
the w3 XML Schema Part 0: Primer here:
http://www.w3.org/TR/xmlschema-0/#specifyingUniqueness under the heading "A
Unique Composed Value"

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!







Marc Zbyszynski
System Architect
Database and Reporting Department
DoubleClick Inc.
450 West 33rd St.
New York, NY 10001
mzbyszynski@doubleclick.net






Received on Tuesday, 26 March 2002 10:15:04 GMT

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