Question: Is it possible to restrict the number of times an element can have a certain value through XSD?
Scenario: I have an element <ITEM> which has three child elements:
<ITEM_BOOLEAN> <NAME_ELEMENT> <ITEM_MEMO_ELEMENT>
<ITEM_BOOLEAN> is restricted to only allow the values of "Y" or "N" is XSD
I would like to restrict that only one occurance of <ITEM> may contain the value "Y" in the child element <ITEM_BOOLEAN> and all other occurances of <ITEM_BOOLEAN> must be "N" for all other <ITEM> elements
What I want to validate: Only one occurance of "Y" in <ITEM_BOOLEAN>
<ROOT>
<ITEM>
<ITEM_BOOLEAN>Y</ITEM_BOOLEAN>
<NAME_ELEMENT>Foo<NAME_ELEMENT>
<ITEM_MEMO_ELEMENT>Bar<ITEM_MEMO_ELEMENT>
</ITEM>
<ITEM>
<ITEM_BOOLEAN>N</ITEM_BOOLEAN>
<NAME_ELEMENT>Foo<NAME_ELEMENT>
<ITEM_MEMO_ELEMENT>Bar<ITEM_MEMO_ELEMENT>
</ITEM>
<ITEM>
<ITEM_BOOLEAN>N</ITEM_BOOLEAN>
<NAME_ELEMENT>Foo<NAME_ELEMENT>
<ITEM_MEMO_ELEMENT>Bar<ITEM_MEMO_ELEMENT>
</ITEM>
</ROOT>
Should Not Validate: Multiple Occurances of "Y" in <ITEM_BOOLEAN>
<ROOT>
<ITEM>
<ITEM_BOOLEAN>Y</ITEM_BOOLEAN>
<NAME_ELEMENT>Foo<NAME_ELEMENT>
<ITEM_MEMO_ELEMENT>Bar<ITEM_MEMO_ELEMENT>
</ITEM>
<ITEM>
<ITEM_BOOLEAN>Y</ITEM_BOOLEAN>
<NAME_ELEMENT>Foo<NAME_ELEMENT>
<ITEM_MEMO_ELEMENT>Bar<ITEM_MEMO_ELEMENT>
</ITEM>
<ITEM>
<ITEM_BOOLEAN>N</ITEM_BOOLEAN>
<NAME_ELEMENT>Foo<NAME_ELEMENT>
<ITEM_MEMO_ELEMENT>Bar<ITEM_MEMO_ELEMENT>
</ITEM>
</ROOT>