We have a process which needs to read a rather complicated XML file and then apply a set of "override" values to the result. Using JAXB and the XML schema, we've generated
Java classes to represent the data and when I use JAXB to unmarshal the main XML file, it works fine. The Override XML file, however, just contains a small number of elements which are meant to override the corresponding elements in the main XML file.
The intent is that we'll read in the main XML file which will initialize the data instance, then read in the override XML file, go through the elements contained within and update the data instance.
The problem is that the override XML file contains elements which refer to other common elements using IDREFs and these common elements are not in the override file. When we use JAXB to read in the override XML file, it replaces the reference with "null". Is there any way I can get the parser to ignore the fact that the element wants to refer to another element and just let me see what the reference id value is?
One option I can think of is to create (by hand, I guess) a set of data classes specifically for the elements used in the override files such that they don't employ the IDREFs. Then I would be able to read the raw data - but this would be a lot of work and introduce a dependency on these classes and any changes which may be made to the structure of the override XML files in the future.
Thanks for any pointers.