Re: conditional schemas

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 UTC