[Solved] Can't open file: Format error in content.xml

Discuss the spreadsheet application
Locked
KevBowler300
Posts: 4
Joined: Tue Jul 26, 2022 2:26 am

[Solved] Can't open file: Format error in content.xml

Post by KevBowler300 »

I'm getting the error:

Read-Error.
Format error discovered in the file in sub-document content.xml at 2,2756481 (row,col).

This is the first time I've ever gotten such a message in years of using OO. It's quite a large spreadsheet (7MB) that I hope can be fixed.

 Edit: Changed subject, was Can't open file because Read-Error 
The important part of the message is second line after the very general "Read-Error" 
-- MrProgrammer, forum moderator 
Last edited by KevBowler300 on Wed Jul 27, 2022 11:22 am, edited 2 times in total.
OpenOffice 4.1.13 on Windows 10
FJCC
Moderator
Posts: 9549
Joined: Sat Nov 08, 2008 8:08 pm
Location: Colorado, USA

Re: Can't open file because Read-Error

Post by FJCC »

There is a tutorial here about how to fix that. Your error will be different than the one shown there but the basic idea is the same. If you have trouble, you can post the document on a publicly available site such as a cloud drive or a file sharing site.
OpenOffice 4.1 on Windows 10 and Linux Mint
If your question is answered, please go to your first post, select the Edit button, and add [Solved] to the beginning of the title.
KevBowler300
Posts: 4
Joined: Tue Jul 26, 2022 2:26 am

Re: Can't open file because Read-Error

Post by KevBowler300 »

OpenOffice 4.1.13 on Windows 10
User avatar
robleyd
Moderator
Posts: 5383
Joined: Mon Aug 19, 2013 3:47 am
Location: Murbko, Australia

Re: Can't open file because Read-Error

Post by robleyd »

Tried, but the content.xml is too big - over 155 Mb - for any of my text editors to open.
Slackware 15 64 bit
Apache OpenOffice 4.1.15
LibreOffice 25.2.4.3; SlackBuild for 25.2.4 by Eric Hameleers
---------------------
Roses are Red, Violets are Blue]
Unexpected '{' on line 32
.
User avatar
MrProgrammer
Moderator
Posts: 5282
Joined: Fri Jun 04, 2010 7:57 pm
Location: Wisconsin, USA

Re: Can't open file because Read-Error

Post by MrProgrammer »

This is quite a mess:
Found                       Expected
</table:table-cell<         </table:table-cell>       Bad end of tag
table:formula= …"           table:formula="…"         Missing quote in attribute value
<vable:table-cell …>        <table:table-cell …>      Misspelled tag

However after fixing those easy problems, numerous errors remain:
Opening and ending tag mismatch: p line 2 and table-cell
fice:value-type="float" office:value="75"><text:p>75>/text:p></table:table-cell>

Opening and ending tag mismatch: table-cell line 2 and table-row
 table:style-name="ce738" table:number-columns-repeated="11"/></table:table-row>

Opening and ending tag mismatch: table-row line 2 and table
:table-cell table:number-columns-repeated="48"/></table:table-row></table:table>

Opening and ending tag mismatch: table line 2 and spreadsheet
/table:sort></table:database-range></table:database-ranges></office:spreadsheet>

Opening and ending tag mismatch: spreadsheet line 2 and body
table:database-range></table:database-ranges></office:spreadsheet></office:body>

Opening and ending tag mismatch: body line 2 and document-content
ble:database-ranges></office:spreadsheet></office:body></office:document-content

Premature end of data in tag document-content line 2

A tag mismatch means the tags are not nested properly, for example:
Right          Wrong          Wrong
<a>            <a>            <a>
   <b>            <b>            <b>
   </b>           </a>
</a>           </b>           </a>

Since your file has over 5 million tags, it is impractical for me to manually examine them to determine how to fix the tag mismatch problems. I know of no programs which could do that automatically. Some of the mismatches could be simple spelling errors, like vable (problem #3), though I think that is unlikely. Restore your file from a backup. Your operating system may be making backups of files each time they're changed. If not, this is surely a feature all modern operating systems can provide.

robleyd wrote: Tue Jul 26, 2022 5:39 am Tried, but the content.xml is too big - over 155 Mb - for any of my text editors to open.
On my Mac I use tool xmllint to analyze the XML. It runs in a few seconds. I can open the XML in TextEdit to view the details of the analysis, though opening the file takes it about a minute and a half. I used sed to fix the first three problems. It runs in a few seconds. TextEdit, xmllint, and sed are all included with MacOS.
Mr. Programmer
AOO 4.1.7 Build 9800, MacOS 13.7.6, iMac Intel.   The locale for any menus or Calc formulas in my posts is English (USA).
FJCC
Moderator
Posts: 9549
Joined: Sat Nov 08, 2008 8:08 pm
Location: Colorado, USA

Re: Can't open file because Read-Error

Post by FJCC »

I got a version that opens in Calc by fixing the first three errors that MrProgrammer found. If the OP sends me a private message with an email address, I will send the file. It is very late for me, so I will not do anything about this for several hours.
OpenOffice 4.1 on Windows 10 and Linux Mint
If your question is answered, please go to your first post, select the Edit button, and add [Solved] to the beginning of the title.
KevBowler300
Posts: 4
Joined: Tue Jul 26, 2022 2:26 am

Re: Can't open file because Read-Error

Post by KevBowler300 »

FJCC wrote: Tue Jul 26, 2022 7:49 am I got a version that opens in Calc by fixing the first three errors that MrProgrammer found. If the OP sends me a private message with an email address, I will send the file. It is very late for me, so I will not do anything about this for several hours.
Sent you the PM.

MrProgrammer wrote: Tue Jul 26, 2022 7:16 am Since your file has over 5 million tags, it is impractical for me to manually examine them to determine how to fix the tag mismatch problems. I know of no programs which could do that automatically. Some of the mismatches could be simple spelling errors, like vable (problem #3), though I think that is unlikely. Restore your file from a backup. Your operating system may be making backups of files each time they're changed. If not, this is surely a feature all modern operating systems can provide.

robleyd wrote: Tue Jul 26, 2022 5:39 am Tried, but the content.xml is too big - over 155 Mb - for any of my text editors to open.
On my Mac I use tool xmllint to analyze the XML. It runs in a few seconds. I can open the XML in TextEdit to view the details of the analysis, though opening the file takes it about a minute and a half. I used sed to fix the first three problems. It runs in a few seconds. TextEdit, xmllint, and sed are all included with MacOS.
It's got a lot of data I've accumulated over the years, I should probably break it up into multiple files or clear out some old stuff once it's working. It's just weird that I've been using that file for quite some time and never had an issue.
OpenOffice 4.1.13 on Windows 10
FJCC
Moderator
Posts: 9549
Joined: Sat Nov 08, 2008 8:08 pm
Location: Colorado, USA

Re: Can't open file because Read-Error

Post by FJCC »

I'll note that the characters that were present in the damaged document differed from the correct characters by a value of 2 in the ASCII table. That is

Code: Select all

Present   Corrected
   <           >
 [space]      "
    v          t  
I don't know much about such things, but that suggests to me some flaky memory in your computer.
OpenOffice 4.1 on Windows 10 and Linux Mint
If your question is answered, please go to your first post, select the Edit button, and add [Solved] to the beginning of the title.
User avatar
MrProgrammer
Moderator
Posts: 5282
Joined: Fri Jun 04, 2010 7:57 pm
Location: Wisconsin, USA

Re: Can't open file because Read-Error

Post by MrProgrammer »

The basic "Latin-1" characters are in four groups of 32:
   000xxxxx - Control characters like tab and newline
   001xxxxx - Non-letters like period, quote, parentheses, …
   010xxxxx - Upper case letters A to Z and a few others
   011xxxxx - Lower case letters a to z and a few others
The digits are a subset of the second group 00110000 to 00111001.

FJCC wrote: Tue Jul 26, 2022 3:33 pm I'll note that the characters that were present in the damaged document differed from the correct characters by a value of 2 in the ASCII table.
I remember we have seen other cases of character substitution with single-bit errors. For me, Calc is still unable to read the file after I fix these three characters, but I would expect that given the "tag mismatch" errors that remain, so I'm glad you were able to solve those problems.
BitError2.gif
BitError2.gif (32.66 KiB) Viewed 4015 times
 Edit: Image replaced since karolus (below) is of course correct. Haha. I just added space between the "nibbles" of the bits which I had labelled as "Hex". 
Mr. Programmer
AOO 4.1.7 Build 9800, MacOS 13.7.6, iMac Intel.   The locale for any menus or Calc formulas in my posts is English (USA).
User avatar
karolus
Volunteer
Posts: 1226
Joined: Sat Jul 02, 2011 9:47 am

Re: Can't open file because Read-Error

Post by karolus »

[Nitpicking] Instead …Hex I would name it …Bin, because its a binary representation[/Nitpicking]
AOO4, Libreoffice 6.1 on Rasbian OS (on ARM)
Libreoffice 7.4 on Debian 12 (Bookworm) (on RaspberryPI4)
Libreoffice 24.8… flatpak on Debian 12 (Bookworm) (on RaspberryPI4)
John_Ha
Volunteer
Posts: 9600
Joined: Fri Sep 18, 2009 5:51 pm
Location: UK

Re: Can't open file: Format error in content.xml

Post by John_Ha »

Do a deep and thorough test of your PC's memory as it looks like a hardware fault in the memory.

Make sure you have a proper independent backup which is not overwritten.

Enable Always make a backup copy in Tools > Options > Load/Save (Properties? on Mac). Be aware the backup file is created/overwritten when you open the file, make a change(s) and then save the file.
LO 6.4.4.2, Windows 10 Home 64 bit

See the Writer Guide, the Writer FAQ, the Writer Tutorials and Writer for students.

Remember: Always save your Writer files as .odt files. - see here for the many reasons why.
KevBowler300
Posts: 4
Joined: Tue Jul 26, 2022 2:26 am

Re: Can't open file: Format error in content.xml

Post by KevBowler300 »

I've now got the file and it's working. Thanks for the help everyone :super: :bravo:
OpenOffice 4.1.13 on Windows 10
Locked