XSD - how to ensure atleast one element is present

EDN Admin

Well-known member
Joined
Aug 7, 2010
Messages
12,794
Location
In the Machine
<p align=left><font face=Arial size=2></font> 
Hello,
<p align=left> 
<p align=left>I have a complex type like below and i want to ensure that atleast one of the elements is present - how do i achieve this? Thanks
<p align=left>  <font color="#0000ff" size=2>
<</font><font color="#800000" size=2>xs:complexType</font><font color="#0000ff" size=2>>
<blockquote dir=ltr style="margin-right:0px
<</font><font color="#800000" size=2>xs: sequence</font><font color="#0000ff" size=2>> </font><font color="#0000ff" size=2>
<blockquote dir=ltr style="margin-right:0px
<</font><font color="#800000" size=2>xs:element</font><font color="#0000ff" size=2> </font><font color="#ff0000" size=2>name</font><font color="#0000ff" size=2>=</font><font size=2>"One</font><font size=2>"</font><font color="#0000ff" size=2> </font><font color="#ff0000" size=2>type</font><font color="#0000ff" size=2>=</font><font size=2>"</font><font color="#0000ff" size=2>One</font><font size=2>"</font><font color="#0000ff" size=2> </font><font color="#ff0000" size=2>minOccurs</font><font color="#0000ff" size=2>=</font><font size=2>"</font><font color="#0000ff" size=2>0</font><font size=2>"</font><font color="#0000ff" size=2> </font><font color="#ff0000" size=2>maxOccurs</font><font color="#0000ff" size=2>=</font><font size=2>"</font><font color="#0000ff" size=2>1</font><font size=2>"</font><font color="#0000ff" size=2> />
<</font><font color="#800000" size=2>xs:element</font><font color="#0000ff" size=2> </font><font color="#ff0000" size=2>name</font><font color="#0000ff" size=2>=</font><font size=2>"</font><font color="#0000ff" size=2>Two</font><font size=2>"</font><font color="#0000ff" size=2> </font><font color="#ff0000" size=2>type</font><font color="#0000ff" size=2>=</font><font size=2>"</font><font color="#0000ff" size=2>Two</font><font size=2>"</font><font color="#0000ff" size=2> </font><font color="#ff0000" size=2>minOccurs</font><font color="#0000ff" size=2>=</font><font size=2>"</font><font color="#0000ff" size=2>0</font><font size=2>"</font><font color="#0000ff" size=2> </font><font color="#ff0000" size=2>maxOccurs</font><font color="#0000ff" size=2>=</font><font size=2>"</font><font color="#0000ff" size=2>1</font><font size=2>"</font><font color="#0000ff" size=2> />
<</font><font color="#800000" size=2>xs:element</font><font color="#0000ff" size=2> </font><font color="#ff0000" size=2>name</font><font color="#0000ff" size=2>=</font><font size=2>"</font><font color="#0000ff" size=2>Three</font><font size=2>"</font><font color="#0000ff" size=2> </font><font color="#ff0000" size=2>type</font><font color="#0000ff" size=2>=</font><font size=2>"</font><font color="#0000ff" size=2>Three</font><font size=2>"</font><font color="#0000ff" size=2> </font><font color="#ff0000" size=2>minOccurs</font><font color="#0000ff" size=2>=</font><font size=2>"</font><font color="#0000ff" size=2>0</font><font size=2>"</font><font color="#0000ff" size=2> </font><font color="#ff0000" size=2>maxOccurs</font><font color="#0000ff" size=2>=</font><font size=2>"</font><font color="#0000ff" size=2>1</font><font size=2>"</font><font color="#0000ff" size=2> />
<</font><font color="#800000" size=2>xs:element</font><font color="#0000ff" size=2> </font><font color="#ff0000" size=2>name</font><font color="#0000ff" size=2>=</font><font size=2>"</font><font color="#0000ff" size=2>Four</font><font size=2>"</font><font color="#0000ff" size=2> </font><font color="#ff0000" size=2>type</font><font color="#0000ff" size=2>=</font><font size=2>"</font><font color="#0000ff" size=2>Four</font><font size=2>"</font><font color="#0000ff" size=2> </font><font color="#ff0000" size=2>minOccurs</font><font color="#0000ff" size=2>=</font><font size=2>"</font><font color="#0000ff" size=2>0</font><font size=2>"</font><font color="#0000ff" size=2> </font><font color="#ff0000" size=2>maxOccurs</font><font color="#0000ff" size=2>=</font><font size=2>"</font><font color="#0000ff" size=2>1</font><font size=2>"</font><font color="#0000ff" size=2> /></font> </blockquote><font color="#0000ff" size=2><font color="#0000ff" size=2>
</</font><font color="#800000" size=2>xs: sequence</font><font color="#0000ff" size=2>> </blockquote>
</</font><font color="#800000" size=2>xs:complexType</font><font color="#0000ff" size=2>> </font></font>

View the full article
 
Back
Top