This project provides support for reading and writing the GEDCOM X File Format.
groupId | artifactId |
---|---|
org.gedcomx |
gedcomx-fileformat |
See the section on using these libraries.
Here's how you might write out a GEDCOM X file. See the gedcomx-model
documentation
for more information about how to build out the model.
Gedcomx gx = ...;
File file = new File("/path/to/file.gedx");
GedcomxOutputStream out = new GedcomxOutputStream(new FileOutputStream(file));
out.addResource(gx);
out.close();
Here's how you might read a GEDCOM X file:
File file = new File("/path/to/file.gedx");
GedcomxFile gxFile = new GedcomxFile(new JarFile(file));
Iterable<GedcomxFileEntry> entries = gxFile.getEntries();
for (GedcomxFileEntry entry : entries) {
//for each entry, read the model.
Gedcomx gx = (Gedcomx) gxFile.readResource(entry);
}