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

Re: conditional schemas

From: Eddie Robertsson <eddie@allette.com.au>
Date: Thu, 29 Nov 2001 09:38:01 +1100
Message-ID: <3C056749.70F2D105@allette.com.au>
To: Erik Beijnoff <erik@addsystems.com>
CC: lieve.laporte@uz.kuleuven.ac.be, xmlschema-dev@w3.org
Hi Erik,


> Wouldn't it be possible to express this with something on the form:
>
> <xs:element name="testelement">
>   <xs:complexType>
>     <xs:choice>
>
>       <xs:element name="actions">
>         <xs:complexType>
>           <xs:sequence>
>             <xs:element name="tag"/>
>           </xs:sequence>
>             <xs:attribute name="name" use="required" fixed="access"/>
>         </xs:complexType>
>       </xs:element>
>
>       <xs:element name="actions">
>         <xs:complexType>
>           <xs:attribute name="name" use="required" fixed="settings"/>
>         </xs:complexType>
>       </xs:element>
>
>     </xs:choice>
>   </xs:complexType>
> </xs:element>

No, as Erik (van der Vlist) already pointed out, this would brake the
unique particle rule in W3C XML Schema. In this case it's because you
define two global elements with the same name but with different types.
Eric also pointed out that you can solve this by using the xsi:type
construct in the instance document but to use this appraoch would in
this case require some preprocessing that checks if the attribute value
really is access and in that case add the xsi:type attribute with the
correct datatype specified.

Cheers,
/Eddie
Received on Wednesday, 28 November 2001 17:31:29 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Monday, 16 March 2009 11:13:19 GMT