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

Re: XSD for 'at least one of'

From: Michael Kay <mike@saxonica.com>
Date: Thu, 06 Jan 2011 18:11:13 +0000
Message-ID: <4D2605C1.3090505@saxonica.com>
To: George Francis <gfrancis1@gmail.com>
CC: xmlschema-dev@w3.org
On 06/01/2011 16:24, George Francis wrote:
> 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:complexTypename="options">
>
> <xs:choiceminOccurs="1"maxOccurs="unbounded">
>
> <xs:elementname='month'type="month"minOccurs="0"/>
>
> <xs:elementname='year'type="year"minOccurs="0"/>
>
> <xs:elementname='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 <mailto:gfrancis1@gmail.com>

Change minOccurs to 1 on year, month, and day.

Michael Kay
Saxonica
Received on Thursday, 6 January 2011 18:13:41 GMT

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