File xmiCasFile = fileChooser.getSelectedFile();
this.main.setXcasFileOpenDir(xmiCasFile.getParentFile());
try {
OutputStream outStream = new BufferedOutputStream(new FileOutputStream(xmiCasFile));
XMLSerializer xmlSerializer = new XMLSerializer(outStream);
XmiCasSerializer xmiCasSerializer = new XmiCasSerializer(this.main.getCas().getTypeSystem());
xmiCasSerializer.serialize(this.main.getCas(), xmlSerializer.getContentHandler());
outStream.close();
} catch (IOException e) {
this.main.handleException(e);
} catch (SAXException e) {
this.main.handleException(e);