java - Spring + JAXB - Unmarshal XML with the same element root -
java - Spring + JAXB - Unmarshal XML with the same element root -
i using resttemplate phone call 2 different rest apis homecoming next xml:
<response><user>...</user></response> <response><client>...</client></response>
in application have 2 classes:
@xmlrootelement(name = "response") class userresponse {...} @xmlrootelement(name = "response") class clientresponse {...}
i don't have command on apis, can't modify response xml.
how can work 2 different responses , same root element?
thanks.
you instead have 1 response class contain user , client class, elements contained in response root element instead. that:
@xmlrootelement(name = "response") @xmlaccessortype(xmlaccesstype.field) class response { @xmlelement(required = false) private user user; @xmlelement(required = false) private client client; } class user { } class client { }
java xml spring jaxb
Comments
Post a Comment