/**
* Parses a workspace element in a service document.
*/
private static RepositoryWorkspace parseWorkspace(XMLStreamReader parser) throws Exception {
RepositoryWorkspace workspace = new RepositoryWorkspace();
next(parser);
while (true) {
int event = parser.getEventType();
if (event == XMLStreamReader.START_ELEMENT) {
AtomElement element = parseWorkspaceElement(parser);
// check if we can extract the workspace id
if ((element != null) && (element.getObject() instanceof CmisRepositoryInfoType)) {
workspace.setId(((CmisRepositoryInfoType) element.getObject()).getRepositoryId());
}
// add to workspace
workspace.addElement(element);
} else if (event == XMLStreamReader.END_ELEMENT) {
break;
} else {
if (!next(parser)) {
break;