Say I have two sets of XML elements:
<One/>
<Two/>
<Three/>
And
<A/>
<B/>
<C/>
And I want to have them as children of a bucket element:
<Bucket>
<A/>
<One/>
</Bucket>
Or
<Bucket>
<C/>
<Two/>
</Bucket>
But I don't want to allow more than one element from either set of elements. I.e:
<Bucket>
<A/>
<B/>
<One/>
</Bucket>
and
<Bucket>
<A/>
<One/>
<Two/>
</Bucket>
would be invalid. How might I express this in my XML Schema?
I thought to try xs:unique
but that prevents name()
and local-name()
usage in the field or selector.
UPDATE
The full solution is:
<xs:element name="Bucket">
<xs:complexType>
<xs:sequence>
<xs:choice minOccurs="0">
<xs:element name="A"/>
<xs:element name="B"/>
<xs:element name="C"/>
</xs:choice>
<xs:choice minOccurs="0">
<xs:element name="One"/>
<xs:element name="Two"/>
<xs:element name="Three"/>
</xs:choice>
</xs:sequence>
</xs:complexType>
</xs:element>