XSD の一意の制約が機能していないようです。次の XSD があります。
<schema xmlns="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://beardedhen.com/form"
xmlns:tns="http://beardedhen.com/form"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
elementFormDefault="qualified">
<xs:complexType name="OptionListType">
<xs:sequence>
<xs:element name="option" minOccurs="1" maxOccurs="unbounded">
<xs:complexType>
<xs:attribute name="label" type="xs:string" use="required"/>
<xs:attribute name="value" type="xs:string" use="required"/>
</xs:complexType>
</xs:element>
</xs:sequence>
<xs:attribute name="name" type="xs:string" use="required"/>
</xs:complexType>
<xs:element name="OptionList" type="tns:OptionListType">
<xs:unique name="uniqueOptionListLabel">
<xs:selector xpath="option"/>
<xs:field xpath="@label"/>
</xs:unique>
</xs:element>
</schema>
以下の XML を Eclipse とオンライン バリデーターの両方で検証すると、エラーは返されません。
<OptionList xmlns="http://beardedhen.com/form"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
name="statusLevels">
<option label="Critical" value="0"/>
<option label="Warning" value="1"/>
<option label="Warning" value="1"/>
<option label="Warning" value="1"/>
<option label="Good" value="4"/>
</OptionList>
それは単純に見え、私が従った例がそこにありますが、これは私を怒らせています! :-)
何か案は?