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) {
String message = e.getMessage() != null ? e.getMessage() : "";
IStatus s = new Status(IStatus.ERROR, CasEditorPlugin.ID, IStatus.OK, message, e);
throw new CoreException(s);
} catch (SAXException e) {
String message = e.getMessage() != null ? e.getMessage() : "";
IStatus s = new Status(IStatus.ERROR, CasEditorPlugin.ID, IStatus.OK, message, e);
throw new CoreException(s);
}
} 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) {
String message = e.getMessage() != null ? e.getMessage() : "";
IStatus s = new Status(IStatus.ERROR, CasEditorPlugin.ID, IStatus.OK, message, e);