我有以下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