Hi all,
I am trying to include a xsd:unique element in my schema to make an
attribute of an element unique at the whole document level.
Consider the following xml fragment:
<Form>
<Question>
<Response id="response1">
</Response>
<Response id="response1">
</Response>
</Question>
<Question>
<Response id="response1">
</Response>
</Question>
</Form>
Here is a fragment of my schema:
<xs:complexType name="Question">
<xs:sequence>
<xs:element minOccurs="0" name="Response" type="Response">
</xs:element>
<xs:unique name="questionResponseNameUnique">
<xs:selector xpath="Response" />
<xs:field xpath="@id" />
</xs:unique>
The problem with my schema is that it only validates the duplicate id
<Responseelements inside the same <Questionelement, not at the whole
document level as I want. Is there any way to achieve this?
Thanks
Miguel