class OpenStackParser {

    public int parseStorageQuotaResponse(String response) throws OCCIException {
    	Attribute totalPerStorage, maxStorages;
        SAXBuilder builder = new SAXBuilder();
        builder.setValidation(false);
        builder.setIgnoringElementContentWhitespace(true);
        Document xmldoc;
        
        log.info("[OpenStackParser] Parsing storage quota response...");
        try {
            xmldoc = builder.build(new StringReader(response));
            XPath xpath = XPath.newInstance("//maxTotalVolumeGigabytes");
            xpath.addNamespace("ns", COMMONNAMESPACE);
            xpath.addNamespace("atom", ATOMNAMESPACE);
            totalPerStorage =
            		(Attribute) xpath.selectSingleNode(xmldoc);
            
            xpath = XPath.newInstance("//maxTotalVolumeGigabytes");
            xpath.addNamespace("ns", COMMONNAMESPACE);
            xpath.addNamespace("atom", ATOMNAMESPACE);
            maxStorages =
            		(Attribute) xpath.selectSingleNode(xmldoc);
            
            if (totalPerStorage != null && maxStorages != null) {
            	//TODO Should we allow it? It can be a source of problems,
            	//   better return only the total per storage?
            	return Integer.parseInt(totalPerStorage.getValue()) *
            			Integer.parseInt(maxStorages.getValue());
            } else {
            	OCCIException exception = new OCCIException();
                exception.setMessage(MALFORMEDRESPONSE);
                log.error(MALFORMEDRESPONSE);
                throw exception;
            }
        } catch (JDOMException e) {
            log.error(e.getMessage());
        } catch (IOException e) {
            log.error(e.getMessage());
        }
        log.debug("[OpenStackParser] Storage quota response parsed...");
        return 0;
    }

}