Let\'s take the following example XML:
NiceDevice
123
Use xs:key and xs:keyref to constrain usesDevices to have a value of a device name:
Then this XML will be valid:
NiceDevice
123
user1
NiceDevice
user2
NiceDevice
But this XML,
NiceDevice
123
user1
NiceDevice
user2
BadDevice
will not,
[Error] try.xml:16:5: cvc-identity-constraint.4.3: Key 'deviceKeyRef' with value 'BadDevice' not found for identity constraint of element 'r'.
as requested.
Note that I've added to your XML a single root element, which is required for your XML to be well-formed.