Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

XML Schema Either/Or or Both

Status
Not open for further replies.

msalamon

Programmer
Feb 12, 2002
1
US
I want to create a complex element that will have the following type of structure:

<parent>
<child1/>
<child2/>
</parent>

The requiremenets are:
EITHER child1 OR child2 must exist, or
BOTH child1 AND child2 must exist

However, it is NOT acceptable if NEITHER child elements exist. (I would also like to allow 0 to unbounded number of child1 elements.)

An example of this is a traditional C-type &quot;switch&quot; statement, where a user can have 0 to N &quot;case&quot; statements, and/or 0 or 1 &quot;default&quot; statements, but cannot be missing both.

Is there any way, using XML Schema language, to ensure that an XML document conforms to these requirements?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top