class OpenStackParser {

    public ComputeCollection parseComputeCollectionResponse (String response)
    		                                             throws OCCIException {
        ComputeCollection ret = null;
        List<Link> linkList;
        Link link;
        SAXBuilder builder = new SAXBuilder();
        builder.setValidation(false);
        builder.setIgnoringElementContentWhitespace(true);
        Document xmldoc;
        
        log.info("[OpenStackParser] Parsing compute collection response...");
        try {
            /**** Get the token ****/
            xmldoc = builder.build(new StringReader(response));
            XPath xpath = XPath.newInstance("//ns:server/@id");
            xpath.addNamespace("ns", COMPUTENAMESPACE);
            xpath.addNamespace("atom", ATOMNAMESPACE);
            List idList = xpath.selectNodes(xmldoc);
            
            xpath = XPath.newInstance("//ns:server/@name");
            xpath.addNamespace("ns", VOLUMENAMESPACE);
            List nameList = xpath.selectNodes(xmldoc);
            
            if (idList.size() == nameList.size()) {
                ret      = new ComputeCollection();
                linkList = new ArrayList<Link>();
                
                for (int i = 0 ; i < idList.size() ; i++) {
                    link = new Link();
                    link.setHref(((Attribute)idList.get(i)).getValue());
                    link.setName(((Attribute)nameList.get(i)).getValue());
                    linkList.add(link);
                }
            } 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] Compute collection response parsed...");
        
        return ret;
    }

}