if (response.isError()) {
throw new FlickrException(response.getErrorCode(), response.getErrorMessage());
}
Collection payload = response.getPayloadCollection();
Iterator iter = payload.iterator();
PhotoContext photoContext = new PhotoContext();
while (iter.hasNext()) {
Element element = (Element) iter.next();
String elementName = element.getTagName();
if (elementName.equals("prevphoto")) {
Photo photo = new Photo();
photo.setId(element.getAttribute("id"));
photoContext.setPreviousPhoto(photo);
} else if (elementName.equals("nextphoto")) {
Photo photo = new Photo();
photo.setId(element.getAttribute("id"));
photoContext.setNextPhoto(photo);
} else if (elementName.equals("count")) {
// TODO: process this information
} else {
System.err.println("unsupported element name: " + elementName);
}