How to extract, edit, and then re-compress XML from a gramps family tree export file
A quick tip for data geeks on how to access the text-editable XML version of a gramps export file and then to re-format it to import back into the gramps genealogy software. This assumes you can do a tiny bit of command line typing.
How to extract XML from a ".gramps" file
- Open up your terminal ("cmd" on Windows) and cd (change directory) to wherever your downloaded your gramps file (example: "data1.gramps") is located.
- To uncompress the file, type in this command:
gunzip < data1.gramps > data.xml
How to edit the XML from a ".gramps" file
You can clean up or otherwise edit your XML family tree data using a simple, free text editor like geany or notepad++. Because you will mostly just be finding and replacing text, you probably don't need the more powerful free and paid editors, such as Netbeans or OxygenXML.
One of my favorite things to do with this XML is to clean up the way I've named places. For example, by replacing the abbreviation "OH" with the full name of the state "Ohio".
How to re-compress XML into a ".gramps" file
To re-compress the file into a format gramps can import, type in this command:
gzip -c data.xml > data2.gramps
For more information
- Gramps Wiki: an explanation of the gramps file format.
- An explanation of gunzip & gzip commands.