Since Hagar's posts above we have had more examples posted to the forum and have been able to investigate the problem in more detail.
It appears that there are (at present)
two different problems which require slightly different solutions. The sequence of fixing either problem is: (see full details in Hagar's posts above).
1. Open the file - you will get an error message like the image below. Record the 3309 number - it tells you where the error is located in the file.
- error message.png (6.34 KiB) Viewed 32918 times
2. Unzip the .odt file and extract the content.xml file.
3. Open content.xml with an XML editor and click in the file until the editor shows that the cursor is at or close to the number (3309) you recorded. You have now found the location of the error. Once you have found the location you may find it easier to "pretty print" the file so it is easier to see what is happening.
4. Repair the error as described for the two cases below. If you pretty printed in Step 3
Linearise the XML (it undoes the pretty printing) before saving the file.
5. Save content.xml.
6. Insert content.xml back into the .odt file.
The .odt file is now repaired.
The two cases are as follows:
Case 1: Multiple added "office:name="__Annotation__714_93247550611111""
These additions appear
in the middle of the first style definition in the file and corrupt it. They should not be there so the fix is to
delete all occurrences of them so as to restore the style definition.
- Note that the P1 Style has been corrupted by the addition of several Annotations.
You need to delete ALL occurrences of the Annotations until the P1 Style has been corrected.
After making any correction(s) it is sensible to use the editor's
XML Syntax Checker to check the XML is grammatically correct. Correct any further errors which are shown to exist.
We are pretty certain this error happens when a .odt file has
- two or more comments attached to highlighted ranges of text (as opposed to a location in text)
- the comments have been deleted - probably when Record > Changes was on
If the user now
- keeps Edit > Record Changes ON
- deletes text containing two ranges with comments attached to those ranges
AOO (but not LO) then corrupts the file.
A bug report has been raised - see
Issue 128356 - Track Changes and Annotations on text range can cause corruption. Applies to 4.x (all versions?).
Case 2: Repeated attributes such as w:themeShade, w:themeColor and w:cstheme
These repeated attribute definitions can appear anywhere in the file, and can appear multiple times, and in different places in the file. The fix is to find all repeats, and
delete only the repeats so as to leave
just one occurrence. So, in the example below, delete
w:themeColor="accent1" in the red box.
- When an attribute like w:themeColour is repeated you should delete the REPEATS and leave just ONE occurrence.
After making any correction(s) it is sensible to use the editor's
XML Syntax Checker to check the XML is grammatically correct. Correct any further errors which are shown to exist.
Whereas these errors can occur in .odt files they also occur in .docx files which have been created or edited by LibreOffice. See
[Tutorial] How to fix SAXParse errors in LibreOffice files for full instructions how to fix them.
Why do these errors occur?
We are not sure and investigation is continuing to understand these errors.
It is now known that the
first error can be caused when AOO is used to edit a .odt file; the document has Edit > Record > Changes set to ON; two (or more?) comments, each
attached to a range of characters, are deleted; and the document is saved. AOO 4.1.7 creates the error and it can be replicated. LO 6.3.5.2 does not create the error.
We do not understand how Case 2 errors occur.
SAXParse errors are caused by a known LO bug.