try {
DocumentBuilderFactory domFactory = DocumentBuilderFactory.newInstance();
domFactory.setNamespaceAware(true); // never forget this!
DocumentBuilder builder = domFactory.newDocumentBuilder();
Document doc = builder.parse(new
ByteArrayInputStream(response.getBody().getBytes("UTF-8")));
XPathFactory factory = XPathFactory.newInstance();
XPath xpath = factory.newXPath();
XPathExpression expr = xpath.compile("//photos/photo");
Object result = expr.evaluate(doc, XPathConstants.NODESET);
NodeList nodes = (NodeList) result;
for (int i = 0; i < nodes.getLength(); i++) {
NamedNodeMap map = odes.item(i).getAttributes();n
if(map!=null) {
photoUrlList.add(RequestUrlHelper.getPhotoUrl(createPhoto(map)));
}
}
} catch (Exception e) {
e.printStackTrace();
}