[XMLSCHEMA-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: conditional schemas

From: Eric van der Vlist <vdv@dyomedea.com>
Date: Wed, 28 Nov 2001 18:14:24 +0100
Message-ID: <3C051B70.4070201@dyomedea.com>
To: Erik Beijnoff <erik@addsystems.com>
Cc: "'Lieve Laporte'" <lieve.laporte@uz.kuleuven.ac.be>, xmlschema-dev@w3.org
choice schema conditional
Hi,

Erik Beijnoff wrote:

>  >In this case, wouldn't I have to duplicate everything that is inside 
> the "actions" element? 'Cause that's quite a lot...
> 
>  >Regards, Lieve
> 
> Ok, here goes...
> 
> <xs:complexType name="outer">
>   <xs:choice>
>     <xs:element name="action" type="actionsWithAccess"/>
>     <xs:element name="action" type="actionsWithSettings"/>
>   </xs:choice>
> </xs:complexType>


No, you can't do this (having two elements with the same name under a 
choice compositor) with W3C XML Schema since it would be breaking the 
famous Unique Particle Attribution rule:

"A content model must be formed such that during ·validation· of an 
element information item sequence, the particle contained directly, 
indirectly or ·implicitly· therein with which to attempt to ·validate· 
each item in the sequence in turn can be uniquely determined without 
examining the content or attributes of that item, and without any 
information about the items in the remainder of the sequence."

http://www.w3.org/TR/xmlschema-1/#cos-nonambig

 
You can workaround this using a xsi:type attribute in the instance

document to "help" the schema processor but this has (of course)
an impact of the instance document.

Eric
-- 
See you in Orlando for XML 2001.
                                     http://www.xmlconference.net/xmlusa/
------------------------------------------------------------------------
Eric van der Vlist       http://xmlfr.org            http://dyomedea.com
http://xsltunit.org      http://4xt.org           http://examplotron.org
------------------------------------------------------------------------
Received on Wednesday, 28 November 2001 12:14:29 GMT

Subscribe to the Stylus Scoop newsletter for helpful XML tips and tutorials.
Email
First Name
Last Name
Company

Download Stylus Studio 6 XML Enterprise Edition

Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2007 All Rights Reserved.