Skip to content

Decoding a Document

Elliot Chance edited this page Jan 25, 2020 · 1 revision

Decoding a GEDCOM stream:

ged := "0 HEAD\n1 CHAR UTF-8"

decoder := gedcom.NewDecoder(strings.NewReader(ged))
document, err := decoder.Decode()
if err != nil {
  panic(err)
}

If you are reading from a file you can use NewDocumentFromGEDCOMFile:

document, err := gedcom.NewDocumentFromGEDCOMFile("family.ged")
if err != nil {
    panic(err)
}

Package gedcom contains functionality for encoding, decoding, traversing, manipulating and comparing of GEDCOM data.

Clone this wiki locally