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

xml schema question

From: Peter Menzel <peter.menzel@imise.uni-leipzig.de>
Date: Fri, 23 Jul 2004 13:53:22 +0200
Message-ID: <4100FC32.7040006@imise.uni-leipzig.de>
To: xmlschema-dev@w3.org

Hi all,

i am working on a xml schema and have the following problem, maybe 
somebody can help me.

I would like to have the follwoing element with content:

<element>
   <aa/>
   <cc/>
   <bb/>
</element>

The elements aa and bb are required to be there and they have to occur exactly once.
Other sub elements of element can occur many times. Especially 
the order of the elements is random, so i may not use xsd:sequence.

My xml schema snippet for this element:

<xsd:element name='element'>
  <xsd:complexType>
      <xsd:choice>
           <xsd:element ref='dd' minOccurs='0' maxOccurs='unbounded'/>
           <xsd:element ref='cc' minOccurs='0' maxOccurs='unbounded'/>
           <xsd:element ref='aa' minOccurs='1' maxOccurs="1"/>
           <xsd:element ref='bb' minOccurs='1' maxOccurs="1"/>
       </xsd:choice>
   </xsd:complexType>
</xsd:element>

Unfortunately this wont work.
xmllint says that the above xml document is not valid with this schema.

Has anybody any idea concerning this problem? Is it generally possible 
to mix elements in a complexType  with different minOccurs/maxOccurs ?

Greetings, Peter 
Received on Friday, 23 July 2004 07:55:25 UTC

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