class Workspace {

        public void parseXML(List<RemoteMapContext> mapContextList,XMLStreamReader parser) throws XMLStreamException, UnsupportedEncodingException {
                List<String> hierarchy = new ArrayList<String>();
                RemoteMapContext curMapContext = null;
                Locale curLocale = null;
                StringBuilder characters = new StringBuilder();
                for (int event = parser.next();
                        event != XMLStreamConstants.END_DOCUMENT;
                        event = parser.next()) {
                        // For each XML elements
                        switch(event) {
                                case XMLStreamConstants.START_ELEMENT:
                                        hierarchy.add(parser.getLocalName());
                                        if(RemoteCommons.endsWith(hierarchy,"contexts","context")) {
                                                curMapContext = new RemoteOwsMapContext(cParams);
                                                curMapContext.setWorkspaceName(workspaceName);
                                        }
                                        // Parse attributes
                                        for (int attributeId = 0; attributeId < parser.getAttributeCount(); attributeId++) {
                                                String attributeName = parser.getAttributeLocalName(attributeId);
                                                if (attributeName.equals("id")) {
                                                        curMapContext.setId(Integer.parseInt(parser.getAttributeValue(attributeId)));
                                                } else if (attributeName.equals("date")) {
                                                        String attributeValue = parser.getAttributeValue(attributeId);
                                                        try {
                                                                curMapContext.setDate(parseDate(attributeValue));
                                                        } catch (ParseException ex) {
                                                                LOGGER.warn(I18N.tr("Cannot parse the provided date {0}",attributeValue),ex);
                                                        }
                                                } else if (attributeName.equals("lang")) {
                                                         curLocale=LocalizedText.forLanguageTag(parser.getAttributeValue(attributeId));
                                                }
                                        }
                                        break;
                                case XMLStreamConstants.END_ELEMENT:
                                        if(RemoteCommons.endsWith(hierarchy,"contexts","context")) {
                                                mapContextList.add(curMapContext);
                                                curMapContext = null;
                                        } else if (RemoteCommons.endsWith(hierarchy,"contexts","context","title")) {
                                                Locale descLocale = Locale.getDefault();
                                                if(curLocale!=null) {
                                                        descLocale = curLocale;
                                                }
                                                curMapContext.getDescription().addTitle(descLocale,StringEscapeUtils.unescapeHtml4(characters.toString().trim()));
                                        } else if(RemoteCommons.endsWith(hierarchy,"contexts","context","abstract")) {
                                                Locale descLocale = Locale.getDefault();
                                                if(curLocale!=null) {
                                                        descLocale = curLocale;
                                                }
                                                curMapContext.getDescription().addAbstract(descLocale, StringEscapeUtils.unescapeHtml4(characters.toString().trim()));
                                        }
                                        characters = new StringBuilder();
                                        curLocale = null;
                                        hierarchy.remove(hierarchy.size()-1);
                                        break;
                                case XMLStreamConstants.CHARACTERS:
                                        characters.append(StringEscapeUtils.unescapeHtml4(parser.getText()));
                                        break;
                        }                               
                }                
        }

        public  Workspace(ConnectionProperties cParams, String workspaceName);

}