XSD: Restrict only one child element to have specific value



I have a XML which reads



<Options>
<option1>Y</option1>
<option2>N</option2>
<option3>N</option3>
</Options>


I would like to ensure only one child element (of Options) has value Y so that above XML is valid but now the below one.



<Options>
<option1>Y</option1>
<option2>Y</option2>
<option3>N</option3>
</Options>


I tried unique and referential integrity but couldn't work out.


Any help/idea much appreciated.


Thanks


No comments:

Post a Comment