Repairing ELAN annotation files from before 2005 for use with ELAN 4.9.4 or newer

We noticed that ELAN annotation files (EAFs) from 2004 and earlier would not open in ELAN 4.9.4, the most recent
version of it. The problem is somewhat serious in that it does not alert one or show the reason for not showing any
tiers or annotations. ELAN 4.9.4 would open the files without any specific notification and just showing an empty
tiers and media section.

Han Sloetjes informed me that ELAN has a log dialog under View > View Log…. We identified the issue to be a
missing attribute in the older EAF XML. The old XML root tag looks like this:

The issue with this problem is that many linguists working on ELAN annotations and opening older EAFs will
potentially get confused and might assume that they lost the data and start writing over the old EAFs and really
lose the previous data and work. Please be aware of this issue and if you have archived EAFs from 2005 or earlier,
you might have to correct the EAF XML to be able to view and edit it in the most recent ELAN.

I told Han that it might be a good idea to include the code in new ELAN releases to correct this error
automatically, since many archived files might be affected by this issue.

If you have a lot of older ELAN files with this issue, here is a script or set of commands that will add this
attribute to the XML. You will need some version of Python 3.x to run this script. If you run this in an Unix
environment (Mac OS X, Linux, Windows 10 with Linux Subsystem and Bash), you will also need find. This script
will create a backup-copy of all EAFs that are repaired. I strongly recommend that you create your own backup copy
and verify that the repaired EAFs can be opened with the newer versions of ELAN.

To repair all EAFs in the local folder, assuming that the script elanrepair.py is executable: