public void serialize(OutputStream out) throws CoreException {
if (DocumentFormat.XCAS.equals(format)) {
XCASSerializer xcasSerializer = new XCASSerializer(mCAS.getTypeSystem());
XMLSerializer xmlSerialzer = new XMLSerializer(out, true);
try {
xcasSerializer.serialize(mCAS, xmlSerialzer.getContentHandler());
} catch (IOException e) {
throwCoreException(e);
} catch (SAXException e) {
throwCoreException(e);
}
} else if (DocumentFormat.XMI.equals(format)) {
XmiCasSerializer xmiSerializer = new XmiCasSerializer(mCAS.getTypeSystem());
XMLSerializer xmlSerialzer = new XMLSerializer(out, true);
try {
xmiSerializer.serialize(mCAS, xmlSerialzer.getContentHandler());
} catch (SAXException e) {
throwCoreException(e);
}
} else {
throw new CoreException(new Status(IStatus.ERROR, CasEditorPlugin.ID, IStatus.OK,