Page 3 of 23

Re: [Hint] How did I fix my ODT file

Posted: Tue Dec 13, 2011 12:15 pm
by oceanTheOne
Hi,

I've lost and tried to recover my work too, but nothing happend. Content.xml seems not corrupted, can someone help me?
File is attached.

Thanks

Re: [Hint] How did I fix my ODT file

Posted: Tue Dec 13, 2011 4:24 pm
by acknak
Try this one:

Re: [Hint] How did I fix my ODT file

Posted: Tue Dec 13, 2011 5:50 pm
by oceanTheOne
acknak wrote:Try this one:
You are greatt!!

How did you fix it?

Re: [Hint] How did I fix my ODT file

Posted: Tue Dec 13, 2011 9:47 pm
by acknak
It only required a few minor adjustments to the content.xml file using a text editor; there was no data corruption.

I presume it's just a bug in the software that gets triggered in certain cases.

A good backup copy is the best way to avoid it ;-)

Re: [Hint] How did I fix my ODT file

Posted: Fri Dec 16, 2011 6:17 am
by dahaoleboy
When I try to open my file, all I get is the following error message:
"READ-ERROR. Format error discovered in the file in sub-document content.xml at 2,1062014 (row,col)."

I've over a week of many, many hours creating 2 custom sheets ( Daily Expenses, Yearly Expenses ) within the file that I would very much like to not lose. I know nothing about how to try the recovery performed by acknak in the primary situation I'm submitting this reply to.

My file is too big to be attached to this e-mail, per the error message I got when I tried, so... would you please submit to me the step-by-step process of repair? I'm not an experienced troubleshooter of such problems.

LibreOffice 3.4.4 on XP = my system.

Thank you for any assistance you may choose to offer.

p.s.: My back-up copy has the same problem... !!!

E-mail removed, nobody will reply by mail and it will avoid spam bots to register your address (Hagar, Moderator).

Re: [Hint] How did I fix my ODT file

Posted: Fri Dec 16, 2011 9:20 am
by Hagar Delest
Step by step instructions have been given in this topic. You need a good XML parser (I use XML Copy Editor) and find the wrong tag.
If you can't attach a file, use a 3rd party site like mediafire, as many have done in this topic.

Re: [Hint] How did I fix my ODT file

Posted: Sat Dec 17, 2011 5:41 am
by dahaoleboy
Never mind... just delete my inquiry. I copied the content.xml file to content-xml.txt, opened that file in notepad, couldn't make heads-nor-tails out of what I was looking at, so opened the file using LibreOffice SWriter 3.4.4 & wound-up with a 437 page monster file. I still can't understand what I'm looking at, nor for, so have abandoned a full week's ( every possible minute ) work & am restarting the file creation in SCalc, without starting-off by adding into an existing file, like I did before. This way, the file won't be over 400KB in size to start.

Thank you for getting back to me, Hagar, but I wouldn't even know how to get, nor what to do with, an XML parser.
Respectfully,
Dave

Re: [Hint] How did I fix my ODT file

Posted: Sat Dec 17, 2011 7:49 pm
by acknak
Drop me an email; I'd can take a look at the file privately, if you like.

If you can get an intact content.xml file out of the document, there's an even chance it can be repaired.

Re: [Hint] How did I fix my ODT file

Posted: Tue Dec 20, 2011 5:12 pm
by acknak
The file was sent to me privately and I was able to fix the problem.

Since dahaoleboy asked for some details, and I've seen this same problem in two damaged Calc files recently, here's what I did. I'm working in Linux, so the precise steps will only work in that environment, but the overall strategy can be pursued on any system with similar tools.

0) Prep - make a copy of the damaged file, and a new directory to work in
  • $ cp damaged.ods damaged_copy.ods
    $ mkdir work
    $ cd work
1) Extract the content.xml portion of the document archive:
  • $ unzip ../damaged.ods content.xml
2) Run an xml syntax checker to see what errors are found
  • $ xmllint -noout content.xml
    content.xml:2: parser error : Attribute table:end-cell-address redefined
    :end-x="0.1409in" table:end-y="0.135in" draw:z-index="3" table:style-name="ce43"
    content.xml:2: parser error : Attribute table:end-x redefined
    :end-x="0.1409in" table:end-y="0.135in" draw:z-index="3" table:style-name="ce43"
    ...
So the problem is that some xml elements have attributes that are defined more than once within the same element. That's not valid xml, and OOo refuses to open the document.

We have to find which elements have the duplicate attributes and edit the xml so that only one set of attributes is present.

3) Open the content.xml file in a text editor (I use emacs, but any good editor should be fine)

The offending xml element looks like this (after some formatting):
  • <table:table-cell
      table:end-cell-address="&apos;Daily Expenses&apos;.U7"
      table:end-x="0.1413in" table:end-y="0.002in" draw:z-index="0"
      table:end-cell-address="&apos;Daily Expenses&apos;.U6"
      table:end-x="0.1409in" table:end-y="0.1398in" draw:z-index="2"
      table:end-cell-address="&apos;Daily Expenses&apos;.U6"
      table:end-x="0.1409in" table:end-y="0.135in" draw:z-index="3"
      table:style-name="ce43"
    />
You can see that there are actually three repeated definitions of the same attributes here.

I don't know exactly what these attributes do, and I don't know which definitions are the correct ones. The only strategy I have is to assume that the last set is the most recent and toss out the previous definitions. So, after removing the first two sets, the element looks like this:
  • <table:table-cell
      table:end-cell-address="&apos;Daily Expenses&apos;.U6"
      table:end-x="0.1409in" table:end-y="0.135in" draw:z-index="3"
      table:style-name="ce43"
    />
Repeat the process for any other problems, and save the modified content.xml.

4) Replace the content.xml in the document copy with the updated (fixed) version:
$ zip ../damaged_copy.ods content.xml

Text the modified copy in OOo Calc--it works! Be happy. :D

This is clearly a bug in OOo--it's generated and saved invalid xml--but obviously it does not happen all the time, not even with the same file. I have no idea what triggers this particular error, but thankfully it's rather straightforward to fix.

Re: [Hint] How did I fix my ODT file

Posted: Tue Dec 20, 2011 8:20 pm
by dahaoleboy
THANK YOU, THANK YOU, THANK YOU, acknak. My file is now useable & I'm indebted to you for your assistance. Also, thanks for sharing how you fixed it as that provides us all with a little training to help make us better users.

One more question... In looking at the code you removed, i.e.,
table:end-cell-address="&apos;Daily Expenses&apos;.U7"
table:end-x="0.1413in" table:end-y="0.002in" draw:z-index="0"
table:end-cell-address="&apos;Daily Expenses&apos;.U6"
table:end-x="0.1409in" table:end-y="0.1398in" draw:z-index="2"
2 different cells are involved... U7 & U6. Shouldn't (or couldn't) U7 remain, or is there something else I'm not recognizing?

dahaoleboy

p.s.: I, too, use Linux... but only a little, so far. Someday, I'll become fully into using it... after finding compatible substitutes for Quicken, Turbo Tax, & Family Tree Maker... especially the inter-connection of the 1st two.

Re: [Hint] How did I fix my ODT file

Posted: Tue Dec 20, 2011 9:58 pm
by acknak
dahaoleboy wrote:One more question... In looking at the code you removed, ... Shouldn't (or couldn't) U7 remain, or is there something else I'm not recognizing?
Honestly, your guess is as good as mine.

There must be only one value provided for the table:end-cell-address attribute, but which one is the right one, I can only guess.

Note that the spreadsheet cell that these properties apply to is 'Daily Expenses'.U5. I'm not sure what effect the end-cell-address setting has on the referenced cells. Maybe someone else knows, or wants to dig into the ODF spec and try to understand their purpose.

Re: [Hint] How did I fix my ODT file

Posted: Tue Dec 27, 2011 4:36 am
by TraceyC
Many many thanks to acknak for detailing the steps to fix this problem. After reading through this thread, I was able to recover a Calc file that had been created in OO and opened in LibreOffice. It's been used / saved in LO for a few months, but I see the LO version still references OO.

In any case, the cell that I believe caused the problem contained a link to a formula in a cell in another spreadsheet. I noticed that when I opened the recovered spreadsheet, that cell had #REF. When I converted that to a number, all the rest of the formulas worked as expected. I just wanted to share this in case it helps the excellent OpenOffice developers find a fix for this annoying bug.

Re: [Hint] How did I fix my ODT file

Posted: Sat Feb 25, 2012 10:45 pm
by n6psu
Hi,

I have the same problem and I need some help as well as anyone. Because I speak very bad English, I can't understand in your above recommendations of the report. I would be very very grateful if someone could help me. I can send this fail to someone's email. Please help!

Re: [Hint] How did I fix my ODT file

Posted: Sun Feb 26, 2012 1:29 am
by acknak
I'll be happy to take a look at the broken document, but I can't promise any success at fixing it. Just email me (email button at right) and I'll send you an address you can send the document to.

Re: [Hint] How did I fix my ODT file

Posted: Mon Feb 27, 2012 1:03 am
by floris v
Received a file by mail but it was damaged beyond what Zip Repair Tool 3.2 could recover. It only found a few graphics. None of my ordinary ZIP file programs could even open it.

Re: [Hint] How did I fix my ODT file

Posted: Mon Feb 27, 2012 5:00 pm
by fire_qc
Please someone help me... I'm not very good in XML and after reading all the posts, this one seems very tough. My file contains all my working hours of 2012 and if I lost it, I'm going to bankrupt!!

Here a paste of what the xmllint tell me:

fire@linux-lar5:~/temp> xmllint --debugent content.xml
new input from file: content.xml
content.xml:2: parser error : Attribute table:end-cell-address redefined
e="ce50" table:content-validation-name="val7" table:number-columns-repeated="12"
^
content.xml:2: parser error : Attribute table:end-x redefined
e="ce50" table:content-validation-name="val7" table:number-columns-repeated="12"
^
content.xml:2: parser error : Attribute table:end-y redefined
e="ce50" table:content-validation-name="val7" table:number-columns-repeated="12"
^
content.xml:2: parser error : Attribute draw:z-index redefined
e="ce50" table:content-validation-name="val7" table:number-columns-repeated="12"
^
content.xml:2: parser error : Attribute table:end-cell-address redefined
e="ce50" table:content-validation-name="val7" table:number-columns-repeated="12"
^
content.xml:2: parser error : Attribute table:end-x redefined
e="ce50" table:content-validation-name="val7" table:number-columns-repeated="12"
^
content.xml:2: parser error : Attribute table:end-y redefined
e="ce50" table:content-validation-name="val7" table:number-columns-repeated="12"
^
content.xml:2: parser error : Attribute draw:z-index redefined
e="ce50" table:content-validation-name="val7" table:number-columns-repeated="12"
^
content.xml:2: parser error : Attribute table:end-cell-address redefined
e="ce50" table:content-validation-name="val7" table:number-columns-repeated="12"
^
content.xml:2: parser error : Attribute table:end-x redefined
e="ce50" table:content-validation-name="val7" table:number-columns-repeated="12"
^
content.xml:2: parser error : Attribute table:end-y redefined
e="ce50" table:content-validation-name="val7" table:number-columns-repeated="12"
^
content.xml:2: parser error : Attribute draw:z-index redefined
e="ce50" table:content-validation-name="val7" table:number-columns-repeated="12"
^

Please help me somone....

FIRE........

Re: [Hint] How did I fix my ODT file

Posted: Mon Feb 27, 2012 5:08 pm
by floris v
Sent a PM.

Re: [Hint] How did I fix my ODT file

Posted: Mon Feb 27, 2012 5:21 pm
by acknak
fire_qc wrote:...
Here a paste of what the xmllint tell me:
...
content.xml:2: parser error : Attribute table:end-cell-address redefined
...
This is exactly the same problem we discussed above: http://user.services.openoffice.org/en/ ... 49#p213749

The fix is exactly the same, although the xml is different. You have to remove the duplicate xml attributes so that there is only one unique value for the attribute.

You may have to guess as to which is the "right" value.

Re: [Hint] How did I fix my ODT file

Posted: Mon Feb 27, 2012 5:33 pm
by fire_qc
I finally succeed to repair it, basing on what you said earlier!!!! But to help me, with emacs, I found the place with the problem. When opening LibreOffice, it gave me 2,324160(row,col) so I go to that position with emacs, remove repeated things, rezip, reopen with LibreOffice. The first time it tells me to fix ti, click yes and voilĂ !!!

Many thanks to everybody!! I'm still alive, Though I'm old, trite and weary (Still Alive - Nocturnal Rites)..

FIRE.........

Re: [Hint] How did I fix my ODT file

Posted: Thu Mar 22, 2012 2:16 pm
by Turgon_Magno
Hello, could you please help me with this file: http://www.mediafire.com/?jcxwa9bifjxw98k

I have the same problem: "Read-Error. Format error discovered in the file in sub-document content.xml at 2,263038 (row,col)."

Thank you!!!

Re: [Hint] How did I fix my ODT file

Posted: Thu Mar 22, 2012 4:45 pm
by floris v
It seems that the archive is damaged. Zip repair Tool reduced the critical content.xml to a zero byte file, so that looks bad.

Re: [Hint] How did I fix my ODT file

Posted: Thu Mar 22, 2012 8:05 pm
by acknak
Most of the content.xml is garbled, but I was able to recover a small amount of it.

Re: [Hint] How did I fix my ODT file

Posted: Tue May 01, 2012 4:14 am
by patriki
2012_INVOICES.ods
(19.66 KiB) Downloaded 5518 times
Please somebody help me recover this file! I get the same Format Error. Tried uzipping it, are able to see the content.xml, but there are like over a dozen of "</office:automatic-styles>" tags - and whatever I tried, made the file useless... This is probably the most advanced computing I have ever had to deal with so far. :)
Can someone help?

Re: [Hint] How did I fix my ODT file

Posted: Wed May 02, 2012 2:51 am
by acknak
All I could get back:

Re: [Hint] How did I fix my ODT file

Posted: Wed May 02, 2012 4:26 am
by patriki
Thanks for trying!!!!!
Gone baby gone..... :(

Re: [Hint] How did I fix my ODT file

Posted: Sun Jul 15, 2012 1:50 am
by yeoford
Can anyone help with this .odt issue - novice

I was creating and saving an important open office document for my course when the system crashed. Could not get back into the file which was encoded with # all over the page.

First window popped up stating document in use 'July%202012%20couns%20essay%20prof%20issues.odt' locked for editing Unknown user.

I opened as read only and saved a copy all text showing as #. I have also saved a copy of the original now corrupted file in another folder and it opens straight into the doucument but still only shows # text all over every page.

husband has spent hours trying to sort but cannot

can anyone fix this please or is it bust.
July 2012 couns essay prof issues.odt
(24.37 KiB) Downloaded 5681 times

Re: [Hint] How did I fix my ODT file

Posted: Sun Jul 15, 2012 5:39 am
by acknak
So sorry, nothing there to recover: the file contains nothing but zeros.

Re: [Hint] How did I fix my ODT file

Posted: Sun Jul 15, 2012 11:11 am
by yeoford
Thanks for taking a look. Back to starting another days work. I'll backup this time. :(

Re: [Hint] How did I fix my ODT file

Posted: Mon Jul 23, 2012 4:23 pm
by nuukee
Similar problem here.

Have a file created in OO. Saved that with LO a while back and got the "Format Error".

The problem was the same as above. One attribute was used 4 times. So removed three occurences and everything worked.
Now a few weeks later, countless edits later the same problem occured. Format error, four occurences of one attribute in one tag. Removed them, xml looks ok. Can open it with xml editors without any problems, also xmllint does not complain anymore.
However, I still cannot open the file. No I receive:

1. "The file is corrupted blabla click yes to repair"
2. "The file '$(ARG1)' could not be repaired and therefore cannot be opened" ... I click ok and LO terminates with "General Error"

I tried many things, including the complete removal of the tag, playing around with neighboring tags etc. always with the same result.
Any further suggestions? Thank you very much!

Re: [Hint] How did I fix my ODT file

Posted: Mon Jul 23, 2012 7:06 pm
by acknak
Maybe someone else has an idea, but it's hard to say much of anything without having the file to examine. You can attach it here, or upload it somewhere else and leave a link here.