W3C home > Mailing lists > Public > xmlschema-dev@w3.org > February 2010

RE: Using xs:all question

From: Michael Kay <mike@saxonica.com>
Date: Fri, 12 Feb 2010 22:44:04 -0000
To: "'Hintz, David'" <david.hintz@siemens.com>, <xmlschema-dev@w3.org>
Message-ID: <7B93053974704E93BA7D6229CFFE0FDA@Sealion>
Can't be done this way in XSD 1.0. The classic solution is to write the
model as ( bc? | cb? ), which of course expands exponentially if there are
more than two possible children.
 
Regards,

Michael Kay
http://www.saxonica.com/
http://twitter.com/michaelhkay 


  _____  

From: xmlschema-dev-request@w3.org [mailto:xmlschema-dev-request@w3.org] On
Behalf Of Hintz, David
Sent: 12 February 2010 17:23
To: xmlschema-dev@w3.org
Subject: Using xs:all question



Hi,

 

I want to define an element <a> that allows <b> or <c> in any order.
Elements <b> and <c> are both optional, but <a> cannot be empty (requires at
least one of <b> or <c>).

 

I thought this would work, but no joy (insists that both <b> and <c> are
required) with Arbortext Editor:

 

  <xs:element name="a">

    <xs:complexType>

      <xs:all minOccurs="0">

        <xs:element ref="b"/>

        <xs:element ref="c"/>

      </xs:all>

    </xs:complexType>

  </xs:element>

 

Is there an easy way to do what I want using <xs:all>?  I know how to do it
otherwise, but <xs:all> seems much more elegant.

 

Dave

 
Received on Friday, 12 February 2010 22:44:32 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 23:15:55 UTC