According to this, you can make use of xs:key and xs:keyref when marshalling and unmarshalling data in JAXB 2.x.
However, I can't find a working example of this being done anywhere.
What we're doing is setting a lookup section in each XML message containing the details for the reference/code values (id, name, description, etc), and then have the data elements later in the message refer back to these items using their key. XML schema defines and supports this through xs:keyref and xs:key (xs:IDREF is not an allowed option).
What I'd like to do is have my JAXB unmarshaller follow these refs dynamically, replacing the key with the referenced object.
Could anybody refer me to an example of this being done?