Coder Social home page Coder Social logo

gedcom's Introduction

gedcom

Go package to parse GEDCOM files into Go structures. Also write these to GEDCOM files.

GoDoc

Note

This is a fork of github.com/iand/gedcom with major revisions and additions.

This design is very brittle in that it does not handle user defined tags without coding changes.

Usage

The package provides a Decoder with a single Decode method that returns a Gedcom struct. Use the NewDecoder method to create a new decoder.

This example shows how to parse a GEDCOM file and list all the individuals. In this example the entire input file is read into memory, but the decoder is streaming so it should be able to deal with very large files: just pass an appropriate Reader.

    package main

    import (
        "bytes"
        "github.com/djhenderson/gedcom"
        "io/ioutil"
    )

    func main() {
        data, _ := ioutil.ReadFile("testdata/kennedy.ged") // read all data

        d := gedcom.NewDecoder(bytes.NewReader(data)) // make the decoder

        g, _ := d.Decode() // decode all data

        for _, rec := range g.Individual { // for all individuals
            if len(rec.Name) > 0 { // check that individual has a name
                println(rec.Name[0].Name) // print the name
            }
        }
    }

The structures produced by the Decoder are in types.go and correspond roughly 1:1 to the structures in the GEDCOM specification.

This package does not implement the entire GEDCOM specification, I'm still working on it. It's been tested with all available of GEDCOM files. It has been extensively tested with non-ASCII character sets and with pathalogical cases such as the GEDCOM 5.5 Torture Test Files.

Installation

Simply run

go get github.com/djhenderson/gedcom

Documentation is at https://godoc.org/github.com/djhenderson/gedcom

Authors

Contributing

  • Do submit your changes as a pull request
  • Do your best to adhere to the existing coding conventions and idioms.
  • Do run go fmt on the code before committing
  • Do feel free to add yourself to the CREDITS file and the corresponding Contributors list in the the README.md. Alphabetical order applies.
  • Don't touch the AUTHORS file. An existing author will add you if your contributions are significant enough.
  • Do note that in order for any non-trivial changes to be merged (as a rule of thumb, additions larger than about 15 lines of code), an explicit Public Domain Dedication needs to be on record from you. Please include a copy of the statement found in the WAIVER file with your pull request

License

This is free and unencumbered software released into the public domain. For more information, see http://unlicense.org/ or the accompanying UNLICENSE file.

gedcom's People

Contributors

djhenderson avatar iand avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

haraldlmueller

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.