Re: XSD for 'at least one of'

Michael Kay <[email protected]>
Newsgroups gmane.text.xml.schema.devel
Message-ID <[email protected]>
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: [email protected] <mailto:[email protected]>

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

Michael Kay
Saxonica
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.