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

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
Re: conditional schemas
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

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.