W3C home > Mailing lists > Public > www-xml-schema-comments@w3.org > April to June 2000

Instance-parameterised constraints

From: Peter van de Hoef <peter.vandehoef@springsite.com>
Date: Thu, 25 May 2000 21:44:58 +0200
Message-ID: <91264DB3B2D7D31191D5009027BDBFB17B74@C00>
To: www-xml-schema-comments@w3.org

We are working on an application based on XML Schemas that supports
configurable products.
We would like to specify constraints in schemas based on the values of
certain elements in the instance document. 
This is what you call instance-parameterised constraints. The current
version of the XML Schema specs do not support this but could you give me
some hints about the way you would solve this?

We are thinking in the direction of specifying expressions instead of
constant values in occurrence constraints or other attributes. See example
below. Whats your opinion?

For example the following should be possible. If the value "VW Golf" is
specified for "Model" then a "CarrierSet" can be chosen too (maxOccurs="1").
If the value "VW Cabrio" is specified for "Model" then a "CarrierSet" is not
allowed (maxOccurs="0").

<complexType name="Car">

	<element name="Model">
		<simpleType base="string">
			<enumeration value="VW Golf" />
			<enumeration value="VW Cabrio" />

	<!-- CarrierSet. Not allowed when Model "VW Cabrio" is chosen. -->
	<!-- CarrierSet. Allowed when another Model is chosen. -->

	<element name="CarrierSet" type="boolean" 
		maxOccurs="'Model' == 'VW Cabrio' ? '0' : '1'" /> <!--
Expression instead of constant value -->


With regards, 
Peter van de Hoef

Received on Thursday, 25 May 2000 15:50:35 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 23:08:47 UTC