How can I parse this list in Java? I have List<Image>
which returns from server, but I can't get a single item.
<images>
<image>
uploads/posts/2008-10/1225141003_1-21.jpg
</image>
<image>
uploads/posts/2008-10/1225141003_1-22.jpg
</image>
</images>
@Root(name = "Images") public class Images {
@ElementList(required=false, inline = true) private List<Image> imageList; public List<Image> getImageList() { return imageList; }
}
@Root(name = "image") public class Image {
//Some code.......
}
I solved this problem in this way:
@Root(name = "images")
public class Images {
@ElementList(entry = "image", required=false, inline = true)
private List<String> imageList;
public List<String> getImageList() {
return imageList;
}
}