The foundation of identity constraints is a test for equality. Each key sequence specified by a unique or key identity constraint must be distinct: the test is equality (or more correctly, lack of equality). Additionally, each key sequence specified by a keyref identity constraint must exist as a key sequence in the target node set to which the keyref refers: again, the test is equality. In an XML schema, two values are equal when:
The simple types for the two values are identical, or one simple type is a derivation of the other. The derived simple type may be a built-in derived datatype or a user-derived simple type.
The value in the value space is equal.
For example, none of the string '"3"', the integer '3', the float '3.0', or the double '3.0' are equal. Conversely, any of the following with the value '3' are equal: an unsignedInt, an unsignedLong, a nonNegativeInteger, an integer, or a decimal. Logically, the value in the lexical space does not have to be identical. For example, a float with the value '3.0' is equal to a float with the value '3'.