I would like to know if there is a way to decouple the XML containing the fixed name of the element whose attribute belongs to many classes. Consider the following XML:
Case No. 1:
<?xml version="1.0" encoding="UTF-8"?> <response> <request-status>valid</request-status> <interface name="person"> <f-name>Joe</f-name> <l-name>Blow</l-name> <age>25</age> <email> joe.blow@email.com </email> </interface> </response>
Case No. 2:
<?xml version="1.0" encoding="UTF-8"?> <response> <request-status>valid</request-status> <interface name="vehicle"> <make>Ford</make> <type>truck</type> <year>1989</year> <model>F150</model> </interface> </response>
In both cases, the contained class is the "response", with two instance variables: requestStatus (String) and an interface (some superclass?). I need help on how to write the contained "Answer" class with the correct JAXB annotations so that unmarshall creates the correct class instances for the "interface" variable.
Thanks for the help for any help.
source share