XML Schema question

4 views
Skip to first unread message

TahoeKid

unread,
Apr 22, 2009, 4:33:22 PM4/22/09
to Java_Official
Is there a way to force "no duplicates" in an enumeration?
For instance:
<xsd:element name="action" maxOccurs="4">
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:enumeration value = "action 1"/>
<xsd:enumeration value = "action 2"/>
<xsd:enumeration value = "action 3"/>
<xsd:enumeration value = "action 4"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>

This is OK

<foo>
<action>action 3</action>
<action>action 4</action>

But not this:

<foo>
<action>action 3</action>
<action>action 3</action>
</foo>

So any string, but now two of the same. I've not found an example of
this anywhere.
The schema above does not enforce no duplicates.
Reply all
Reply to author
Forward
0 new messages