XPath xpath = XPathFactory.newInstance().newXPath();
NodeList items = (NodeList) xpath.evaluate("/rss/channel/item", doc, XPathConstants.NODESET);
// Extract parking informations
for (int i = 0; i < items.getLength(); i++) {
Element item = (Element) items.item(i);
Parking parking = new Parking();
// Parking name
parking.setName(((Element) item.getElementsByTagName("title").item(0)).getTextContent());
// Parking incoming address
tmpElt = (Element) item.getElementsByTagName("vdlxml:localisation").item(0);
tmpElt = (Element) tmpElt.getElementsByTagName("vdlxml:localisationEntree").item(0);
parking.setAddress(tmpElt.getTextContent());
// Parking zone in Luxemburg town
NodeList adrs = item.getElementsByTagName("vdlxml:quartier");
for (int j = 0; j < adrs.getLength(); j++) {
tmpElt = (Element) adrs.item(j);
if (localeUsed.equalsIgnoreCase(tmpElt.getAttribute("lang"))) {
parking.setZone(tmpElt.getTextContent());
break;
}
}
// Parking total capacity
parking.setCapacity(((Element) item.getElementsByTagName("vdlxml:total").item(0)).getTextContent());
if (StringUtils.isEmpty(parking.getCapacity())) {
parking.setCapacity("-1");
}
// Parking available place
parking.setAvailable(((Element) item.getElementsByTagName("vdlxml:actuel").item(0)).getTextContent());
if (StringUtils.isEmpty(parking.getAvailable())) {
parking.setAvailable("-1");
}
// Parking filling status
parking.setFillingStatus(((Element) item.getElementsByTagName("vdlxml:complet").item(0)).getTextContent());
if (StringUtils.isEmpty(parking.getFillingStatus())) {
parking.setFillingStatus("0");
}
// Parking filling trend
parking.setFillingTrend(((Element) item.getElementsByTagName("vdlxml:tendance").item(0)).getTextContent());
if (StringUtils.isEmpty(parking.getFillingTrend())) {
parking.setFillingTrend("0");
}
// Parking open status
parking.setOpen(((Element) item.getElementsByTagName("vdlxml:ouvert").item(0)).getTextContent());
if (StringUtils.isEmpty(parking.getOpen())) {
parking.setOpen("0");
}
// Add parking to list
parkings.add(parking);
}
} catch (Exception e) {