Unmarshall part of XML

merlin3371

New Member
I have this XML\[code\]<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> <soap:Body> <ns2:listItemsResponse xmlns:ns2="http://soap.ws.server.wst.fit.cvut.cz/"> <return> <code>OK</code> <data xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ns2:items"> <item> <itemId>1540041177</itemId> <price>5109</price> </item> <item> <itemId>696734629</itemId> <price>5453</price> </item> <item> <itemId>1853843391</itemId> <price>5088</price> </item> </data> </return> </ns2:listItemsResponse> </soap:Body></soap:Envelope>\[/code\]and I want to unmarshall the \[code\]data\[/code\] element to my POJO (not the whole XML, just the part of it). Is it possible with JAXB?\[code\]@XmlRootElement(name = "data")public class Data { private List<Item> items; public Data() { } @XmlElement(name = "item") public List<Item> getItems() { return items; } public void setItems(List<Item> items) { this.items = items; } @Override public String toString() { return "Data [" + (items != null ? "items=" + items : "") + "]"; }}\[/code\]
 
Back
Top