Hi,
I get this error when trying to open a .odt file. I am using Windows XP and OO 1.9.79
I have several hours in creating this document last night and when I went to open it today I got this message.
It would make my life a lot easier if I could get this file open. Could someone please help me?
Thanks in advance
Rob
Format error discovered in the file in sub document styles.xml at 2,5890 row,(col)
Format error discovered
Re: Format error discovered
The message means that the file has an error in the data. Sometimes it can be recovered--at least partially. The only real solution is good backups.
If you can post the file here (128k max), or at a file sharing site (mediafire.com or mytempdir), or if you prefer, email it to me (see my profile), and we'll see what can be done.
Since the error is in the styles, you have a chance of recovering it yourself, by these steps:
1) File > New > Text Document
2) Insert > File ... select your dodgy file, OK
You will lose some of the formatting, but the document content should be there.
If you can post the file here (128k max), or at a file sharing site (mediafire.com or mytempdir), or if you prefer, email it to me (see my profile), and we'll see what can be done.
Since the error is in the styles, you have a chance of recovering it yourself, by these steps:
1) File > New > Text Document
2) Insert > File ... select your dodgy file, OK
You will lose some of the formatting, but the document content should be there.
AOO4/LO5 • Linux • Fedora 23
Re: Format error discovered
Rob mailed his file to me. It turned out to be a simple problem in the XML, one which I have seen before: repeated xmlns (namespace) definitions. Rather than ignoring or warning about the extra definitions, OOo rejects the whole file. I don't know enough about XML namespaces to say if that makes sense or not, but the error can be fixed with no apparent problems by simply removing all the extra definitions.
In styles.xml, the there was this:
<style:style style:name="Graphics" style:family="graphic">
<style:graphic-properties
text:anchor-type="paragraph"
svg:x="0in" svg:y="0in"
style:wrap="none"
style:vertical-pos="top" style:vertical-rel="paragraph"
style:horizontal-pos="center" style:horizontal-rel="paragraph"
xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0"
xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0"/>
</style:style>
Can you spot the duplicate definition in there?
And in content.xml, there was:
<style:style style:name="P1"
style:family="paragraph" style:parent-style-name="Standard">
<style:paragraph-properties
xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0"
fo:font-size="18pt"
xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0"
fo:font-weight="bold"
fo:text-align="start"
style:justify-single-word="false"/>
<style:text-properties
style:font-name="Arial"
style:font-size-asian="18pt" style:font-weight-asian="bold"
style:font-size-complex="18pt" style:font-weight-complex="bold"/>
</style:style>
This duplication was repeated in 14 more style definitions, one of which had three copies of the definition. Other styles had only one (i.e. were correct).
The first definition in each style is ok; after that, any repeats are errors. I didn't realize that the first one in each style was ok, and I deleted all of the xmlns:fo definitions. As far as I could tell, and by Rob's report, it didn't seem to hurt anything.
In styles.xml, the there was this:
<style:style style:name="Graphics" style:family="graphic">
<style:graphic-properties
text:anchor-type="paragraph"
svg:x="0in" svg:y="0in"
style:wrap="none"
style:vertical-pos="top" style:vertical-rel="paragraph"
style:horizontal-pos="center" style:horizontal-rel="paragraph"
xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0"
xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0"/>
</style:style>
Can you spot the duplicate definition in there?
And in content.xml, there was:
<style:style style:name="P1"
style:family="paragraph" style:parent-style-name="Standard">
<style:paragraph-properties
xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0"
fo:font-size="18pt"
xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0"
fo:font-weight="bold"
fo:text-align="start"
style:justify-single-word="false"/>
<style:text-properties
style:font-name="Arial"
style:font-size-asian="18pt" style:font-weight-asian="bold"
style:font-size-complex="18pt" style:font-weight-complex="bold"/>
</style:style>
This duplication was repeated in 14 more style definitions, one of which had three copies of the definition. Other styles had only one (i.e. were correct).
The first definition in each style is ok; after that, any repeats are errors. I didn't realize that the first one in each style was ok, and I deleted all of the xmlns:fo definitions. As far as I could tell, and by Rob's report, it didn't seem to hurt anything.
AOO4/LO5 • Linux • Fedora 23
Re: Format error discovered
Hey acknak, Huw hooked me up on this one. See ajut001/my dialogue [Hint] How did I fix my ODT file and the issue that I reference. I had a browse around the XML import/export and did a bit of step thru in dbg. As far as I can see, the parser seems to be one of those nasty 4GL generator hybrids —largely autogenerated code from the DTD to create a stub framework with the action stubs hand cranked in. You know the sort of thing: Take a 5,000 line DTD autogenerate 30,000 lines of code from it, blend in another 10,000 +/- to give you 40,000 lines of totally unmaintainable spaghetti which can't be read by normal mortals.
The error parsing strategy is that any slightest error is thrown, and caught at the top level with no recovery. At least in the case of mal-formed XML the parser is nice enough to tell you what line it died at. In this other case the XML wasn't malformed, it was just that one of the parameters was outside the limits that OOo will accept, though not necessarily other ODF compliant products. Just throwing an error and not doing a "warn then continue" is a real
The error parsing strategy is that any slightest error is thrown, and caught at the top level with no recovery. At least in the case of mal-formed XML the parser is nice enough to tell you what line it died at. In this other case the XML wasn't malformed, it was just that one of the parameters was outside the limits that OOo will accept, though not necessarily other ODF compliant products. Just throwing an error and not doing a "warn then continue" is a real
- BARFFFF
Ubuntu 11.04-x64 + LibreOffice 3 and MS free except the boss's Notebook which runs XP + OOo 3.3.
Re: Format error discovered
Already there. Excellent work and a fascinating writeup. Thank you!Have a read of the issue.
BTW, do you think this should be reported?
It seems to be this: Issue 48731: Multiple identical attributes in XML element in styles, but that was fixed a long time ago. I don't know what OOo version Rob (the OP here) is using, but I don't think it's that old. Oh wait; never mind: it is that old. He says he's using 1.9.
Rob: Buddy, it's time to upgrade!
AOO4/LO5 • Linux • Fedora 23
Re: Format error discovered
+1 with acknak, Rob. That Issue was fixed in 2.0.1.
However the general functional requirement that the XML parser / importer should just NOT barf "with a cannot load this file" is just unacceptable. This is going to become more and more of an issue as other vendors use ODF as their document standard
However the general functional requirement that the XML parser / importer should just NOT barf "with a cannot load this file" is just unacceptable. This is going to become more and more of an issue as other vendors use ODF as their document standard
Ubuntu 11.04-x64 + LibreOffice 3 and MS free except the boss's Notebook which runs XP + OOo 3.3.