We are using JAXB to map Java classes into XML files. Currently we use the Java-to-XSD approach by annotating the Java classes.
This works fine in general but we've hit the following problem now: we want an attribute of one XML element to refer to another XML element by it's name/ID. Imagine some XML describing a conceptual schema, with the entities defined in <entity> elements and <property> elements used to establish the links. The @type attribute of the properties should then reference an entity in the same file.
Is it possible to model this using JAXB? What I imagine is having xsd:key and xsd:keyref elements in the schema which should then be resolved to the matching Java objects when unmarshalling.