[XMLSCHEMA-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

One of more elements required

From: Age Bosma <agebosma@gmail.com>
Date: Wed, 22 Oct 2008 21:51:20 +0200
Message-ID: <48FF8438.6030104@gmail.com>
To: xmlschema-dev@w3.org
One of more elements required

Hi,

I can't seem to find a solution for the following problem. I hope you
can help me out. Here's a stripped down version of what I've got:

<xsd:complexType name="rootType">
   <xsd:sequence>
      <xsd:element name="platform" type="platformType" minOccurs="0"
maxOccurs="unbounded"/>
      <xsd:element name="device" type="deviceType" minOccurs="0"
maxOccurs="unbounded"/>
   </xsd:sequence>
</xsd:complexType>


Basically, as you can see, the parent element can have zero or more
platform elements AND zero or more device elements.

I'd like to add an additional requirement. The parent element should at
least have one of the two child (platform OR device) elements. How can
this be expressed in XML Schema? Can it be done at all?

Using 'choice' doesn't seem like an option to me since that would only
allow me to include one of the two and not both.

Thank in advance,

Age Bosma
Received on Wednesday, 22 October 2008 21:38:53 GMT

Subscribe to the Stylus Scoop newsletter for helpful XML tips and tutorials.
Email
First Name
Last Name
Company

Download Stylus Studio 6 XML Enterprise Edition

Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2007 All Rights Reserved.