I’m attempting to constrain a schema, which has a lot of xsd:ID and xsd:IDREF, so that, for example, a Person IDREF can only refer to a Person ID.
I wrote a key and keyref constraint thus:
<xsd:element name="ElectionReport" type="ElectionReport">
<xsd:key name="personKey">
<xsd:selector xpath="./Person"/>
<xsd:field xpath="@ObjectId"/>
</xsd:key>
<xsd:keyref name="personKeyRef" refer="personKey">
<xsd:selector xpath="./Election/Candidate"/>
<xsd:field xpath="PersonId"/>
</xsd:keyref>
</xsd:element>
However, when I try it against an example I wrote up (which should throw a validation error), it succeeds with no errors.
I’ve attached both my schema and example file. I am using XMLSpy to validate my instances.
Thanks,
John Dziurlaj
Elections Consultant
Hilton Roscoe LLC
Cell 330-714-8935 Work/Fax 234-706-6434