public double parseTotalCost(String xmlResponse) throws ParserConfigurationException, SAXException, IOException {
double totalCost=0;
DocumentBuilderFactory dbf =
DocumentBuilderFactory.newInstance();
DocumentBuilder db = dbf.newDocumentBuilder();
InputSource is = new InputSource();
is.setCharacterStream(new StringReader(xmlResponse));
Document doc = db.parse(is);
NodeList netPrices = doc.getElementsByTagName("netPrice");
NodeList partNumbers = doc.getElementsByTagName("partNumber");
// iterate the employees
for (int i = 0; i < netPrices.getLength(); i++) {
Element netPrice_e = (Element) netPrices.item(i);
Element partNumber_e = (Element) partNumbers.item(i);
String value_s=netPrice_e.getFirstChild().getNodeValue().replace("EUR", "");
String partNumber_s=partNumber_e.getFirstChild().getNodeValue();
myLog.info("Part: " + partNumber_s + " Value: " + value_s);
try{
double value=Double.parseDouble(value_s);
totalCost+=value;
}catch(Exception e){
myLog.errorException(e);
}
}
return totalCost;
}