Issue 126219 - invalid xml on saving document with comment/annotation
Summary: invalid xml on saving document with comment/annotation
Status: CLOSED DUPLICATE of issue 126479
Alias: None
Product: Writer
Classification: Application
Component: ui (show other issues)
Version: 4.1.1
Hardware: All All
: P5 (lowest) Major (vote)
Target Milestone: ---
Assignee: AOO issues mailing list
QA Contact:
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-04-01 17:13 UTC by Joe Smith
Modified: 2016-06-05 22:37 UTC (History)
4 users (show)

See Also:
Issue Type: DEFECT
Latest Confirmation in: ---
Developer Difficulty: ---


Attachments
Sample document generating error on save (33.83 KB, application/vnd.oasis.opendocument.text)
2015-04-01 17:14 UTC, Joe Smith
no flags Details
aoo401_open_save (ok) (31.16 KB, application/vnd.oasis.opendocument.text)
2015-04-03 12:23 UTC, Oliver Brinzing
no flags Details
aoo411_open_save (error) (31.97 KB, application/vnd.oasis.opendocument.text)
2015-04-03 12:23 UTC, Oliver Brinzing
no flags Details

Note You need to log in before you can comment on or make changes to this issue.
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:style
  office:name="__Annotation__4738_53080995811111111111111"
  office:name="__Annotation__4074_68698293611111111111111111111111111111111111111111111111111111111111111111111111"
  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 https://forum.openoffice.org/en/forum/viewtopic.php?f=7&t=1532.

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 https://forum.openoffice.org/en/forum/viewtopic.php?f=7&t=1532&start=360#p357769 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 ***