private static void writeXmi(CAS cas, File file) throws IOException, SAXException {
FileOutputStream out = null;
try {
out = new FileOutputStream(file);
XmiCasSerializer ser = new XmiCasSerializer(cas.getTypeSystem());
XMLSerializer xmlSer = new XMLSerializer(out, false);
ser.serialize(cas, xmlSer.getContentHandler());
} finally {
if (out != null) {
out.close();
}
}