1

我正在尝试创建一个可以complexType在其中编写以下内容的内容:

<MyType>
    <tag1>Something</tag1>
    <tag2>Tag 1</tag2>
    <tag2>Tag 2</tag2>
    <tag3>Another something</tag3>
</MyTpe>

基本上我希望能够以无特定顺序指定标签,但能够指定tag2无限次。我怎样才能做到这一点?

我已经尝试过 a choice,但似乎它允许任何元素无限次。

这是我的 XSD 的相关部分:

<xsd:complexType name="MyType">
    <xsd:all>
        <xsd:element name="tag1" />
        <xsd:element name="tag3" />
    </xsd:all>
    <xsd:choice maxOccurs="unbounded">
        <xsd:element maxOccurs="unbounded" name="tag2"  />
    </xsd:choice>
</xsd:complexType>
4

0 回答 0