W3C home > Mailing lists > Public > xmlschema-dev@w3.org > October 2001

Schemas Identity Constraint

From: Joan Pujol <joan.pujol@ima.udg.es>
Date: Fri, 26 Oct 2001 09:44:51 +0200
Message-ID: <3BD91473.676CA21E@ima.udg.es>
To: xmlschema-dev@w3.org
Hi,

I have problems with Schema's Identity Contraints.
I can't understand the behaivor of some Xpath expressions on selectors.

For example, if I use ".//*" as the selector, the constraint aparently don't
apply.
And if I use the "*" that is a subcase of ".//*" the contraint is applied.

I readed a little at the Schema Specification(3.11.6), and ".//*" is a well
constructed XPath expresion for a selector.
I think that the problem is that it break one of the Indentity-constraint
Definition Validation Rules (3.11.4), but I can't find which rule.

Someone can help me?


This are my test files:

<?xml version="1.0" encoding="UTF-8"?>
<Root xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="testfile.xsd">
	<Element name="NAME1"/>
    	<Element name="NAME1"/>
</Root>


<?xml version="1.0" encoding="UTF-8"?>
<schema xmlns="http://www.w3.org/2001/XMLSchema">
	<element name="Root">
		<complexType>
			<choice minOccurs="0" maxOccurs="unbounded">
				<element name="Element">
				    <complexType>
					<attribute name="name"/>
				    </complexType>
				</element>
			 </choice>
		</complexType>
		<unique name="IdentityContraint1">
		    <selector xpath=".//*"/>
		    <field xpath="@name"/>
		</unique>	
	</element>
</schema>

Parsing the XML file returns that this is OK (aparently ignoring the Identity
constaint).
If I change the selector for "*" the parser informs of the identity constraint
violation.


Bye,
Received on Friday, 26 October 2001 03:45:08 GMT

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