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

Question about uniqueness

From: odwl <odwl@mac.com>
Date: Tue, 10 Sep 2002 09:02:04 -0400 (EDT)
Cc: Olivier De Wolf <olivier.dewolf@n-side.be>
To: xmlschema-dev@w3.org
Message-Id: <7624FE1A-C4BD-11D6-96E5-0003938232DE@mac.com>




Here is an XML document :

<?xml version="1.0" encoding="ISO-8859-1"?>
<Site xmlns="http://n-side/site/ssShema"
			xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
   		xsi:schemaLocation="http://n-side/site/ssShema 
../schema/ssSchema.xsd">
<Home name="CorHome">
		<Topic name="Your_Needs">
			<View name="Choice_1"/>
			<View name="CorHome"/>
			<View name="Your_Needs2"/>
		</Topic>
		<Topic name="Your_Needs2">
			<View name="Choice_3"/>
			<View name="Choice_4"/>
			<View name="Choice_3"/>
		</Topic>
		<Topic name="Your_Needs"/>
	</Home>
	</Site>

I would like to have a schema that enforces the uniqueness of all the 
"name" attributes (for Home, Topic and View elements). The above 
document is thus not valid (at all).

I inserted the following XML Schema fragment within the Site element 
definition:

		<unique name="idName">		
			<selector xpath=".//*"/>
			<field xpath="@name"/>
		</unique>

But it is not working : there is no validation error for the above 
document.

Note that with the following fragment, it's OK, I have an error because 
of "Choice_3" appearing twice.

		<unique name="idName">		
			<selector xpath=".//View"/>
			<field xpath="@name"/>
		</unique>

and I have the uniqueness of the name in all the View pages


Do I miss something,

Thanks in advance


Olivier
Received on Tuesday, 10 September 2002 17:22:03 GMT

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