return project;
}
public Workspace readWorkspace(XMLStreamReader reader, ProjectImpl project) throws Exception {
WorkspaceImpl workspace = null;
boolean end = false;
while (reader.hasNext() && !end) {
Integer eventType = reader.next();
if (eventType.equals(XMLEvent.START_ELEMENT)) {
String name = reader.getLocalName();
if ("workspaceFile".equalsIgnoreCase(name)) {
//Version
String version = reader.getAttributeValue(null, "version");
if (version == null || version.isEmpty() || Double.parseDouble(version) < 0.7) {
throw new GephiFormatException("Gephi project file version must be at least 0.7");
}
} else if ("workspace".equalsIgnoreCase(name)) {
//Id
Integer workspaceId;
if (reader.getAttributeValue(null, "id") == null) {
workspaceId = project.nextWorkspaceId();
} else {
workspaceId = Integer.parseInt(reader.getAttributeValue(null, "id"));
}
workspace = project.getLookup().lookup(WorkspaceProviderImpl.class).newWorkspace(workspaceId);
WorkspaceInformationImpl info = workspace.getLookup().lookup(WorkspaceInformationImpl.class);
//Name
info.setName(reader.getAttributeValue(null, "name"));
//Status