AnalysisEngineDescription desc = parser.parseAnalysisEngineDescription(new XMLInputSource(inFile), parsingOptions);
// Write out descriptor
File cloneFile = new File(inFile.getParentFile(), "CopyOfAggregateWithManyDelegates.xml");
BufferedOutputStream os = new BufferedOutputStream(new FileOutputStream(cloneFile));
XMLSerializer xmlSerializer = new XMLSerializer(true);
xmlSerializer.setOutputStream(os);
// set the amount to a value which will show up if used
// indent should not be used because we're using a parser mode which preserves
// comments and ignorable white space.
xmlSerializer.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", "4");
ContentHandler contentHandler = xmlSerializer.getContentHandler();
contentHandler.startDocument();
desc.toXML(contentHandler, true);
contentHandler.endDocument();
os.close();