Elements in any order

Hello, 

I am new to XML Schemas and I would like to define 
a schema for allowing two optional elements in any
order within a parent element. That is, all the
following XML documents should be valid.  

  <A>
     <B/>
     <B/>
  </A>

  <A>
     <C/>  <!-- only one of these can appear -->
  </A>

  <A>
     <B/>
     <B/> 
     <C/>
     <B/>
  </A>

  <A> 
    <C/>
    <B/>
    <B/>
  </A>

Although the following XML schema is not valid
(duplicate element names), it represents the class of
XML documents that are valid. 

<xsd:element name="A">
  <xsd:complexType>
    <xsd:sequence>
      <xsd:element name="B" type="xsd:string"
                 minOccurs="0" maxOccurs="unbounded"/>
      <xsd:element name="C" type="xsd:string"
                 minOccurs="O" maxOccurs="1"/>
      <xsd:element name="B" type="xsd:string"
                 minOccurs="0" maxOccurs="unbounded"/>
    </xsd:sequence>
  </xsd:complexType>
</xsd:element> 
     
I tried using <xsd:all> (errors with maxOccurs and
minOccurs) and <xsd:choice> (restricted to only one
<B> and <C>) with no success.

I really appreciate your help in this regard. 

Thanks, 
-Choudary. 


__________________________________
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com

Received on Friday, 8 August 2003 11:53:15 UTC