I am trying to parse an XML message into a Java object. It works for me for the most part, but there is one problem for which I am stuck. I have a circuit that looks like this:
<DeliveryDetails> <Name>Ed</Name> <Location>Toronto</Location> <Event> <Date>2013-05-06</Date> <Time>12:12</Time> <Description>MARKHAM</Description> </Event> <Event> <Date>2013-05-07</Date> <Time>05:12</Time> <Description>MARKHAM</Description> </Event> <Event> <Date>2013-05-08</Date> <Time>15:12</Time> <Description>MARKHAM</Description> </Event> </DeliveryDetails>
Now the problem is that the JAXB ObjectFactory saves only the last event. If there was an element that wrapped events (), I would know how to handle it using the Wrapper XML element. But since there is no wrapper, I'm not sure what to do. Does anyone have any ideas?
I assume that ObjectFactory receives all events, but constantly rewrites the old with the latest. There must be some way to tell him to save every single event, and not just write the same every time, but I donβt know how to do it.
source share