java - Complex Un-Marshalling with Jersey JAX-RS (List of Lists) -
i'm trying figure out best way unmarshal data public api (meaning have no control on how serialized xml).
<show> <name>buffy vampire slayer</name> <totalseasons>7</totalseasons> <episodelist> <season no="1"> <episode>...</episode> <episode>...</episode> <episode>...</episode> <episode>...</episode> </season> <season no="2">...</season> <season no="3">...</season> </episodelist> </show> above sample of xml returned restful query. ideally, i'd figure out how 2 things; 1) merge season lists 1 list of episodes , 2) possible access child elements , ignore parent elements when unmarshalling xml (ex. access episodelist only, ignoring show)?
thank help! first post (still new programming).
i ended creating "helper" classes extract data needed. wrote getepisodelist method in episodelisthelper rolls episodes single list.
episodelisthelper class
@xmlrootelement(name="show") @xmlaccessortype(xmlaccesstype.field) public class episodelisthelper { @xmlelementwrapper(name="episodelist") @xmlelement(name="season") private list<seasonhelper> seasonlist; ... } seasonhelper class
@xmlrootelement @xmlaccessortype(xmlaccesstype.field) public class seasonhelper { @xmlelement(name="episode") private list<episode> list; ... }
Comments
Post a Comment