class OpenStackParser {

    public Storage parseStorageResponse (String response)
                                              throws OCCIException {
        String id, name, size;
    	Storage ret = null;
        SAXBuilder builder = new SAXBuilder();
        builder.setValidation(false);
        builder.setIgnoringElementContentWhitespace(true);
        Document xmldoc;
        
        log.info("[OpenStackParser] Parsing storage response...");
        try {
            xmldoc = builder.build(new StringReader(response));
            XPath xpath = XPath.newInstance("//ns:volume");
            xpath.addNamespace("ns", BLOCKNAMESPACE);
            xpath.addNamespace("atom", ATOMNAMESPACE);
            xpath.addNamespace("os-vol-host-attr", OSVOLHOSTATTRNAMESPACE);
            xpath.addNamespace("os-vol-image-meta", OSVOLIMAGEMETANAMESPACE);
            xpath.addNamespace("os-vol-tenant-attr", OSVOLTENANTATTRNAMESPACE);
            
            Element result = (Element)xpath.selectSingleNode(xmldoc);
            
            id   = result.getAttributeValue("id");
            name = result.getAttributeValue("name");
            size = result.getAttributeValue("size");
            
            
            if (id != null && name != null && size != null) {
	            ret = new Storage();
	            ret.setDescription(
	                    result.getAttributeValue("description"));
	            ret.setHref(id);
	            ret.setName(name);
	            ret.setSize(size);
	            ret.setType(StorageType.DATABLOCK);
            } 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 response parsed...");
        
        return ret;
    }

}