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

Re: at least one

From: George Cristian Bina <george@oxygenxml.com>
Date: Mon, 22 May 2006 17:30:42 +0300
Message-ID: <4471CB12.60008@oxygenxml.com>
To: Debora Vanni <debora.vanni@tvblob.com>
CC: xmlschema-dev@w3.org

Hi Debora,

If you know all the elements that can go inside filters then you can 
just have a choice model group that contains all the elements and set 
the occurrence on the choice model group to one or more:

<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
   <xs:element name="filters">
     <xs:complexType>
       <xs:choice maxOccurs="unbounded">
         <xs:element name="high"/>
         <xs:element name="medium"/>
         <xs:element name="low"/>
       </xs:choice>
     </xs:complexType>
   </xs:element>
</xs:schema>

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


Debora Vanni wrote:
> Sorry to bother you again,
> I try to look around but I can't find a solution.
> I would like to know if there is some way in XSD to say that a complex
> element should be composed by any but at least one element of a group(=
> some) of elements.
> For example:
> the group is :
> 	<high></high>
> 	<medium></medium>
> 	<low></low>
> 
> This is CORRECT:
> <filters>
> 	<high></high>
> 	<medium></medium>
> 	<low></low>
> </filters>
> 
> This is CORRECT:
> <filters>
> 	<high></high>
> 	<low></low>
> </filters>
> 
> This is INCORRECT:
> <filters>
> 
> </filters>
> I know the maximum number of elements of the group but I don't know
> which and how many they could choose. Everything it's ok but there
> should be at least one!
> Thank you for you help
> Debora Vanni
> 
> 
> 
> 
Received on Monday, 22 May 2006 14:28:14 GMT

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