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

XSD for 'at least one of'

From: George Francis <gfrancis1@gmail.com>
Date: Thu, 6 Jan 2011 11:24:36 -0500
Message-ID: <AANLkTinUDxXq+aznbOZtwg==M89J1dZhH2Jj_e7nQtc-@mail.gmail.com>
To: xmlschema-dev@w3.org
Apologies if this is a PAQ, I can't find the answer.
How do I specify in my XSD that an element must contain at least one of it's
child elements?
 I've tried the following:

   <xs:complexType name="options">

 <xs:choice minOccurs="1" maxOccurs="unbounded">

 <xs:element name='month' type="month" minOccurs="0" />

 <xs:element name='year' type="year" minOccurs="0" />

 <xs:element name='day' type="day" minOccurs="0" />

 </xs:choice>

</xs:complexType>

but it still doesn't seem to care if 'options' is empty.


-- 
George Francis
e-mail: gfrancis1@gmail.com
Received on Thursday, 6 January 2011 17:59:20 GMT

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