I am creating an xsd schema to validate some xml
I would like to limit xml, so it is not possible to enter the same element twice:
<branches> <branche>Bank</branche> <branche>Bank</branche> </branches>
But it should be possible to use 2 different elements:
<branches> <branche>Bank</branche> <branche>Insurance</branche> </branches>
So, I have the following code:
<xs:simpleType name="branche"> <xs:restriction base="xs:string"> <xs:enumeration value="Bank" maxOccurs="1"/> <xs:enumeration value="Insurance" maxOccurs="1"/> </xs:restriction> </xs:simpleType> <xs:element name="branches" minOccurs="0"> <xs:complexType> <xs:sequence> <xs:element name="branche" type="branche" minOccurs="0" maxOccurs="2" /> </xs:sequence> </xs:complexType> </xs:element>
using maxOccurs="1" does not limit it to just one value, because the "branche" tag can occur twice.
I want the value ( <branche>value</branche> ) to be unique.
Thnx!
source share