我有以下XML:验证架构使用属性
<Root>
<SomethingA/>
<SomethingB/>
<SomethingC/>
<SomeOtherThing action="Foo">
<Bar/>
<Bar/>
</SomeOtherThing>
<SomeOtherThing action="Poo">
<BarFoo/>
<BarNoo/>
</SomeOtherThing>
</Root>
我想创建一个架构,将验证,如果该元素是SomeOtherThing,那么如果动作是富子元素只能在酒吧;如果动作是Poo,那么子元素可以是BarFoo(和/或)BarNoo。
关于如何完成(只使用xsd)的任何想法?
此外,解决方案需要在C#上工作。
可能的重复[如何使用模式验证基于属性值的元素?](http://stackoverflow.com/questions/184663/how-can-you-validate-elements-based-on-an -attribute-value-using-a-schema) – rene 2012-08-06 10:49:24
更新问题。我只关心xsd验证解决方案。但无论如何感谢。 – 2012-08-06 13:23:47