Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Re: xs:choice question

From: "Pete Cordell" <petexmldev@--------------.--->
To: "Markus Gamperl" <markus.gamperl@---.-->, <xmlschema-dev@--.--->
Date: 6/28/2007 1:16:00 PM
I think you can change this to the following and get what you want:

 <xs:choice>
 <xs:sequence>
   <xs:element name="a" type="xs:string"/>
   <xs:element name="b" type="xs:string" minOccurs="0"/>
 </xs:sequence>
 <xs:element name="b" type="xs:string"/>
 </xs:choice>

The strategy works for simple cases like this, but doesn't extend well to=
 
having more elements that have to share the same sort of occurrence 
constraints.  This is an area that future schema recommendations are look=
ing 
at.

HTH,

Pete.
--
==========================
====================
Pete Cordell
Codalogic Ltd
for XML Schema to C++ data binding visit
 http://www.codalogic.com/lmx/
==========================
====================

----- Original Message ----- 
From: "Markus Gamperl" <markus.gamperl@g...>
To: <xmlschema-dev@w...>
Sent: Wednesday, June 27, 2007 8:21 PM
Subject: xs:choice question


>
> Hello!
>
> I have the following xml fragment example:
>
> <data>
> <a>a test</a>
> <b>b test</a>
> <data>
>
> the schema should check the following rules (three options):
> - element a must exist, b may not
> - element b must exist, a may not
> - element a and b must exist
>
> Therefor I have defined the following choice:
> ...
> <xs:choice>
> <xs:element name="a" type="xs:string"/>
> <xs:element name="b" type="xs:string"/>
> <xs:sequence>
>   <xs:element name="a" type="xs:string"/>
>   <xs:element name="b" type="xs:string"/>
> </xs:sequence>
> </xs:choice>
> ...
>
> The xml editor raises an error - something about non determenistic 
> declaration...
>
> Do you have a suggestion how to define these three rules?
>
> Thanks for your help!
> Markus
> -- 
> Psssst! Schon vom neuen GMX MultiMessenger geh=F6rt?
> Der kanns mit allen: http://www.gmx.net/de/go/multimessenger
>
> 



From tmrfcm@g... Fri Jun 29 18:38:37 2007
Received: from maggie.w3.org ([193.51.208.68])
	by frink.w3.org with esmt


transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent