class OpenStackParser {

    public List<Disk> parseAttachedStoragesResponse (String response) 
                                                        throws OCCIException {
    	List<Disk> ret = null;
    	Disk disk;
        Link link;
        SAXBuilder builder = new SAXBuilder();
        builder.setValidation(false);
        builder.setIgnoringElementContentWhitespace(true);
        Document xmldoc;
        
        log.info("[OpenStackParser] Parsing attached storages response...");
        try {
            xmldoc = builder.build(new StringReader(response));
            XPath xpath = XPath.newInstance("//volumeAttachment/@volumeId");
            List volumeIdList = xpath.selectNodes(xmldoc);
            
            xpath = XPath.newInstance("//volumeAttachment/@device");
            List deviceList = xpath.selectNodes(xmldoc);
            
            if (volumeIdList.size() == deviceList.size()) {
                ret = new ArrayList<Disk>();
                
                for (int i = 0 ; i < volumeIdList.size() ; i++) {
                	disk = new Disk();
                	link = new Link();
                    link.setHref(((Attribute)volumeIdList.get(i)).getValue());

                    disk.setStorage(link);
                    disk.setTarget(((Attribute)deviceList.get(i)).getValue());
                    
                    ret.add(disk);
                }
            } 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] Attached storages response parsed...");
        
        return ret;
    }

}