0
我尝试为可包含不同类型条目的选择定义复杂类型 但只有一个条目被允许具有属性“multiselect”。XSD使用特定属性限制元素的出现
这里是我的尝试:
<element name="selection" minOccurs="0" maxOccurs="unbounded">
<complexType>
<sequence>
<element name="name" type="string" />
<element name="source">
<complexType>
<choice>
<element name="item" minOccurs="1" maxOccurs="unbounded" type="string" />
<element name="path" type="string" minOccurs="1" maxOccurs="1" />
</choice>
</complexType>
</element>
</sequence>
<attribute name="multiselection" type="boolean" minOccurs="1" maxOccurs="1" />
</complexType>
</element>
的结果应该是有可能的“选择”更多的元素,其中如果源类型是“项目”或类型的也没关系“路径”。但是只有一个“选择”元素被允许具有属性multiselection = true。
但是,因为它似乎没有属性的min-/maxOccures。 我该如何解决这个问题?
THX
你需要更好地解释。也许举一个有效和无效的实例文档的例子。 “multiselect”属性继续哪个元素? – 2013-03-11 12:29:11
我还没有测试过这个,但是尝试在属性值上设置一个'唯一'约束,然后将属性限制为单个值。 – 2013-03-11 13:55:22