XSD - Allow one specific element multiple times while allowing others just one time

37 views Asked by At

I'm trying to create a complexType in which I'm able to write he following:

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

Basically I want to be able to specify the tags in no particular order but be able to specify tag2 unlimited times. How can I do this?

I already tried a choice, but it seems that it would allow any element unlimited times.

Here is the relevant part of my 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>
0

There are 0 answers