Issue 126219

Summary: invalid xml on saving document with comment/annotation
Product: Writer Reporter: Joe Smith <jes>
Component: uiAssignee: AOO issues mailing list <issues>
Severity: Major    
Priority: P5 (lowest) CC: john.ha24, kschenk, oliver.brinzing, orcmid
Version: 4.1.1   
Target Milestone: ---   
Hardware: All   
OS: All   
Issue Type: DEFECT Latest Confirmation in: ---
Developer Difficulty: ---
Description Flags
Sample document generating error on save
aoo401_open_save (ok)
aoo411_open_save (error) none

Description Joe Smith 2015-04-01 17:13:19 UTC
Steps to reproduce:
1) Open the attached Writer document
2) File > Save As (new name) OK
3) File > Reload ...
Read error. Format error (in content.xml)

The problem is here:

  style:name="Table1" style:family="table">

This raises a validity error because the office:name attribute is repeated. Removing one or both names will allow the document to load.

More interesting is that the name attributes are added to the style element: they do not belong there at all, as far as I can see.

Perhaps this has something to do with the new annotation on text ranges feature?

I've seen several (maybe a dozen) damaged documents like this through the OO community forum but this is the first one that consistently generated the problem on saving. So I'm hoping it will allow someone to debug the problem.

Since the damaged document was sent to me in confidence, I have obfuscated the text of the document and removed all the embedded objects and images. The modified document behaves exactly the same way as the original (same two annotation IDs) so it should be useful for testing.
Comment 1 Joe Smith 2015-04-01 17:14:21 UTC
Created attachment 84626 [details]
Sample document generating error on save
Comment 2 Joe Smith 2015-04-01 17:21:21 UTC
I'm testing with AOO 4.1.1 on Fedora Linux
OpenOffice 4.1.1  411m6(Build:9775)
Comment 3 Oliver Brinzing 2015-04-03 12:22:07 UTC
it works if i save and reload the file with aoo401, but aoo411 and aoo412dev will produce the error
Comment 4 Oliver Brinzing 2015-04-03 12:23:15 UTC
Created attachment 84629 [details]
aoo401_open_save (ok)
Comment 5 Oliver Brinzing 2015-04-03 12:23:41 UTC
Created attachment 84630 [details]
aoo411_open_save (error)
Comment 6 John 2016-05-31 13:07:57 UTC
See the forum post "[Hint] How did I fix my ODT file" at

The post includes many reports of corrupted XML files, as well as other forms of data loss in faulty files.

Many uploaded .odt files have been analysed by forum members, and many have been found where the XML tags in content.xml have somehow become corrupted.  acknak has often been able to correct the XML errors manually, and thus recover the file.  

For example, see for a file which has currupted tags, and which refers to this Issue 126219, and where acknak says:

> In case someone is wondering, here is the problem: an easy-to-fix problem in content.xml:
> extra attributes in a style definition:
> <office:automatic-styles>
> <style:style office:name="__Annotation__10737_1353476854111"
>  office:name="__Annotation__5569_679014524111"
>  office:name="__Annotation__12292_187842290111" style:name="P1" style:family="paragraph"
>  style:parent-style-name="Standard">
> <style:paragraph-properties fo:margin-left="0cm" fo:margin-right="0cm" 
>  fo:margin-top="0cm" fo:margin-bottom="0.199cm" .../>
> </style:style>
> Just delete the office:name attributes (blue).
Comment 7 orcmid 2016-05-31 15:52:02 UTC
Thanks for catching this.

I am marking this as a duplicate of Issue or 126479, although that is more recent, since it provides more complete discussion and the same solution.

With regard "easy to fix" we need to ask "for whom" :).  I suppose a repair tool would be handy for this case, if we had one of those to customize.

*** This issue has been marked as a duplicate of issue 126479 ***