ModelParser modelParser = new ModelParser();
Gedcom gedcom = modelParser.parseGedcom(inFile);
gedcom.createIndexes();
if (outputStream != null) {
GedcomMapper mapper = new GedcomMapper();
GedcomxEntrySerializer serializer;
if (json) {
serializer = new JacksonJsonSerialization();
}
else if (bson) {
serializer = new JacksonJsonSerialization(new SmileFactory());
}
else {
serializer = new DefaultXMLSerialization();
}
GedcomxConversionResult result = mapper.toGedcomx(gedcom);
GedcomxOutputStream output = new GedcomxOutputStream(outputStream, serializer);
output.addAttribute("User-Agent", "Gedcom To Gedcomx Java Conversion Utility/1.0");
output.addAttribute("X-DC-conformsTo", "http://gedcomx.org/file/v1");
output.addAttribute("X-DC-created", GedcomxTimeStampUtil.formatAsXmlUTC(new Date()));