我尝试为收到的 XML 文档定义模式。
文件看起来像:
<root>
<items>
<group name="G-1">
<item name="I-1"/>
<item name="I-2"/>
<item name="I-3"/>
<item name="I-4"/>
</group>
</items>
<data>
<group name="G-1" place="here">
<customer name="C-1">
<item name="I-1" count="3"/>
<item name="I-2" count="4"/>
</customer>
<customer name="C-2">
<item name="I-3" count="7"/>
</customer>
</group>
</data>
</root>
我尝试了 .NET 2.0 中的 XmlSpy 和 xsd.exe。两者都创建了允许以下<group>
任意数量的<item>
和<customer>
元素的模式定义。但是我正在寻找的应该限制<group>
在元素之下,并且限制<items>
在元素之下。<item>
<group>
<data>
<customer>
这是 xml 模式根本没有能力的东西吗?