W3C home > Mailing lists > Public > xmlschema-dev@w3.org > July 2004

Re: xml schema question

From: George Cristian Bina <george@sync.ro>
Date: Fri, 23 Jul 2004 15:56:50 +0300
Message-ID: <41010B12.4060405@sync.ro>
To: Robert Koberg <rob@koberg.com>
Cc: Peter Menzel <peter.menzel@imise.uni-leipzig.de>, xmlschema-dev@w3.org

Hi Rob,

That will be equivalent with
<xsd:complexType>
     <xsd:choice minOccurs='0' maxOccurs='unbounded'>
          <xsd:element ref='dd'/>
          <xsd:element ref='cc'/>
          <xsd:element ref='aa'/>
          <xsd:element ref='bb'/>
      </xsd:choice>
</xsd:complexType>

minOccurs and maxOccurs will constrain the number of occurances inside 
the choice model and they have a default value of 1.

If you have
<xsd:complexType>
     <xsd:choice minOccurs='0' maxOccurs='unbounded'>
          <xsd:element ref='dd'/>
          <xsd:element ref='cc'/>
          <xsd:element ref='aa' minOccurs="2" maxOccurs="2"/>
          <xsd:element ref='bb'/>
      </xsd:choice>
</xsd:complexType>

then you should have pairs of aa elements (one aa element after the other).

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


Robert Koberg wrote:
> Just curious: Could something like this work?
> 
> 
> <xsd:element name='element'>
> <xsd:complexType>
>     <xsd:choice minOccurs='0' maxOccurs='unbounded'>
>          <xsd:element ref='dd'/>
>          <xsd:element ref='cc'/>
>          <xsd:element ref='aa' minOccurs='1' maxOccurs="1"/>
>          <xsd:element ref='bb' minOccurs='1' maxOccurs="1"/>
>      </xsd:choice>
>  </xsd:complexType>
> </xsd:element>
> 
> In other words, can you override the choice's min/max at the element level?
> 
> best,
> -Rob
> 
Received on Friday, 23 July 2004 08:56:53 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 5 February 2014 07:15:10 UTC