Currently, the Castor XML code generator does not create any special validation logic for <xsd:IDREF> typed elements/attributes. As a result, it is currently impossible to assess that ...
a) a content element typed with <xsd:IDREF> is not empty.
b) a content element typed with <xsd:IDREF> does point to an existing <xsd:ID> instance.
The idea is to create a new IdRefValidator and modify the XML code generator to make sure that this new validator is called accordingly.