W3C home > Mailing lists > Public > xmlschema-dev@w3.org > January 2006

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

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

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 11 January 2011 00:14:52 GMT