I have tried the following to test that an element has a unique identifier. So far, .net has said that the xml is valid with the xsd but it shouldn't be.
The XML:
<Document>
<Record>
<Id>1</Id>
</Record>
<Record>
<Id>1</Id>
</Record>
</Document>
The XSD:
<?xml version="1.0" encoding="utf-8"?>
<xs:schema id="Filing_new"
targetNamespace="http://tempuri.org/Filing_new.xsd"
elementFormDefault="qualified"
xmlns="http://tempuri.org/Filing_new.xsd"
xmlns:mstns="http://tempuri.org/Filing_new.xsd"
xmlns:xs="http://www.w3.org/2001/XMLSchema">
<!-- Document Schema -->
<xs:element name="Document">
<xs:complexType>
<xs:sequence>
<xs:element name="Record" minOccurs="1" maxOccurs="unbounded">
<xs:complexType>
<xs:sequence>
<xs:element name="Id" type="xs:integer" />
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
<xs:unique name="sequence">
<xs:selector xpath="Record" />
<xs:field xpath="Id" />
</xs:unique>
</xs:element>
</xs:schema>
What am I doing wrong?