Documentation: How to use gedcom4j in your programs

API Documentation (Javadoc)

Javadoc is available here, as well as on Maven Central.

Quick Start

  1. Put gedcom4j.jar in your project's classpath.
    • If you're using Maven, put a dependency to gedcom4j in your pom.xml:
    • <dependency>
              <groupId>org.gedcom4j</groupId>
              <artifactId>gedcom4j</artifactId>
              <version>RELEASE</version>
      </dependency>
  2. Add some code like this to load a GEDCOM file:
  3. GedcomParser gp = new GedcomParser();
    gp.load("../sample/TGC551.ged");
  4. Access the data by working with the properties of the Gedcom structure, available from the GedcomParser's gedcom property:
  5. Gedcom g = gp.getGedcom();
    Submitter submitter = null;
    if (!g.getSubmitters().isEmpty()) {
        submitter = g.getSubmitters().values().iterator().next();
    }
    for (Family f : g.getFamilies().values()) {
        if (f.getHusband() != null && f.getWife() != null) {
            System.out.println(f.getHusband().getIndividual().getNames().get(0).getBasic()
                    + " married " + f.getWife().getIndividual().getNames().get(0).getBasic());
        }
    }

Examples

Example 1: Producing an HTML Ahnentafel Report
Example 2: Finding unrelated individuals in your GEDCOM file
Example 3: Custom tag usage
Example 4: Calculating relationships between individuals
Example 5: Making a GEDCOM file from scratch
Example 6: Finding couples with common ancestors

gedantic- sample application

gedantic is a web-based demonstration application for gedcom4j. You can try it out to see the kinds of things you can do, and the source code is available at https://github.com/frizbog/gedantic.

Project Information

How gedcom4j supports both GEDCOM 5.5 and 5.5.1
Support for ANSEL and Diacritics

Related Standards and Specifications

GEDCOM 5.5 Standard (pdf)
GEDCOM 5.5.1 Standard (pdf)
ANSEL specification
MARC 21 Specification (supersedes ANSEL)