intArrayFS.set(4, 5);
cas.getIndexRepository().addFS(intArrayFS);
// serialize the CAS
StringWriter sw = new StringWriter();
XMLSerializer xmlSer = new XMLSerializer(sw, false);
XCASSerializer xcasSer = new XCASSerializer(cas.getTypeSystem());
xcasSer.serialize(cas, xmlSer.getContentHandler(), true);
String xml = sw.getBuffer().toString();
// deserialize into another CAS
CAS cas2 = CasCreationUtils.createCas(typeSystem, new TypePriorities_impl(), indexes);
XCASDeserializer deser = new XCASDeserializer(cas2.getTypeSystem());
ContentHandler deserHandler = deser.getXCASHandler(cas2);
SAXParserFactory fact = SAXParserFactory.newInstance();
SAXParser parser = fact.newSAXParser();
XMLReader xmlReader = parser.getXMLReader();
xmlReader.setContentHandler(deserHandler);
xmlReader.parse(new InputSource(new StringReader(xml)));
// serialize the new CAS
sw = new StringWriter();
xmlSer = new XMLSerializer(sw, false);
xcasSer = new XCASSerializer(cas.getTypeSystem());
xcasSer.serialize(cas2, xmlSer.getContentHandler(), true);
String xml2 = sw.getBuffer().toString();
// compare
assertTrue(xml2.equals(xml));
}