I have the following xml:
<Root>
<SomethingA/>
<SomethingB/>
<SomethingC/>
<SomeOtherThing action="Foo">
<Bar/>
<Bar/>
</SomeOtherThing>
<SomeOtherThing action="Poo">
<BarFoo/>
<BarNoo/>
</SomeOtherThing>
</Root>
I want to create a schema, that will validate that if the element is SomeOtherThing, then if the action is Foo the child element can only be Bar; if the action is Poo then the child elements can be BarFoo (and/or) BarNoo.
Any ideas on how it can be accomplish (using only xsd)?
Also, the solution need to work on C#.
This kind of conditional validation cannot be done in XSD 1.0. It can be done in XSD 1.1 using the feature called “conditional type assignment”.