Hi XML Experts,
Please let me know whether a regular expression be used to validate the duplicate values in a xml element. The xml element can have comma seperated value from a list of values.
If it is feasible, please share a pattern.
Sample xsd
<schema targetNamespace="http://www.xyz.com/xyz"
xmlns="http://www.w3.org/2001/XMLSchema"
xmlns:x="http://www.xyz.com/xyz"
elementFormDefault="qualified">
<element name="CompanyDetails">
<complexType>
<sequence>
<element name="CountryList" type="x:CountryListType"/>
</sequence>
</complexType>
</element>
<simpleType name="CountryListType">
<restriction base="string">
<pattern value="France|Germany|India"/>
</restriction>
</simpleType>
</schema>
Sample xml
<CompanyDetails>
<CountryList>France,Germany,India</CountryList>
</CompanyDetails>
For example in the CountryList xml element if there is a duplicate entry then the validation need to fail.
<CountryList>France,Germany,India,Germany</CountryList>
Thank You!