I'm trying to marshal/unmarshal from two different XML files to POJOS. The first XML file looks like this:
--Network.xml--
<Network>
<Nodes>
<Node id="ROD" />
<Node id="KFI" />
<Node id="JND" />
</Nodes>
<Arcs>
<Arc fromNode="ROD" />
<Arc fromNode="JND" />
</Arcs>
</Network>
---------
Using @XmlID and @XmlIDREF annotations, I can successfully populate the Arc classes to point to the correct Node which it references.
However, I also have to parse this XML:
--NetworkInputs.xml--
<NetworkInputs>
<Flows>
<Flow toNode="JND" />
<Flow toNode="ROD" />
</Flows>
</NetworkInputs>
------
Currently, my program unmarshals the Network object successfully, but there's no connection between Network and NetworkInputs that allows JAXB to "see" the nodes that exist in Network. I want my Flow objects to point to the correct Node in the Network class.
I basically want to do this: http://old.nabble.com/JAXB-Unmarshalling-and-XmlIDREF-using-different-stores-td14035248.html
I tried implementing this: http://weblogs.java.net/blog/kohsuke/archive/2005/08/pluggable_ididr.html and it just doesn't work, because I can't get the Node data for my populated Network from a static context.
Is it even possible to do something like this?