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

Re: optional, but at least one required

From: George Cristian Bina <george@oxygenxml.com>
Date: Thu, 05 Jan 2006 09:32:37 +0200
Message-ID: <43BCCB95.3010701@oxygenxml.com>
To: bkbonner@gmail.com
Cc: xmlschema-dev@w3.org
minoccurs optional or required

Hello Brian,

You can write the content model as:
(a, b?, c?) | (b, c?) | c

<xs:complexType>
   <xs:choice>
     <xs:sequence>
       <xs:element ref="a"/>
       <xs:element ref="b" minOccurs="0"/>
       <xs:element ref="c" minOccurs="0"/>
     </xs:sequence>
     <xs:sequence>
       <xs:element ref="b"/>
       <xs:element ref="c" minOccurs="0"/>
     </xs:sequence>
     <xs:element ref="c"/>
   </xs:choice>
</xs:complexType>

Best Regards,
George
---------------------------------------------------------------------
George Cristian Bina
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com


Brian Bonner wrote:
> Hello,
> 
> Is there a way through restrictions or xmlschema in general to create
> the following criteria?
> 
> <options>
>      <a></a>
>      <b></b>
>      <c></c>
> </options>
> 
> where the rule is that a, b and c are all optional, but at least one
> of a, b or c is required.
> 
> Thanks.
> 
> Brian
> 
> 
Received on Thursday, 5 January 2006 07:30:58 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.