Cannot read file, bad format

• Nov 4, 2015 - 03:09

When trying to open file, the following message appears: Cannot read file [/File name and location shown.mscz]: bad format.
Details of the error are: XML read error at line 32788 column 23
The file opened without problem the previous day, and the only changes made were to dynamics.
Mac 10.10.5
Musescore 2.0.2


In reply to by KenS

The problem is a piece of text that reads "Oboe & Organ". There were a handful of bugs that could cause the "&" character in text to create corrupt files like this some times. I think all known cases have been fixed in current nightly builds, but if you can think of anything unusual about how you might have created or edited this bit of text, that would help. It would be good to see if the specific bug that you triggered is one of those that has been fixed.

Meanwhile, I have attached a fixed version of your file.

Attachment Size
Cantata 3 Orchestra Sep2015 rev.mscz 39.79 KB

In reply to by Marc Sabatella

Thank you for the speedy help. I don't even know where the text came from, because I have checked a slightly older version of the score and that piece of text does not appear. However, I have previously used ampersands, so I shall steer clear of those in future. I thought the problem may have been something to do with some stray dynamics. When editing the score, I found a few duplicated dynamics markings that I could not highlight to delete, so I suspected it may have been those. Anyway, thanks again.

In reply to by KenS

You're welcome! For the record, ampersands *should* be fine, there are just a few specific situations where they have caused problems, and we fix them as they are reported. Perhaps you were seeing #81501: Copy-and-paste text from external program results in loss of characters after "&" symbol or #72051: Reset text to style causes html escaped sequences to disappear. Both are fixed in current development builds and thus should be fixed for the next release.

I wonder if you could help again, please, same issue. Another file from the same work will not open. Apart from changes to dynamics markings, I noticed that some staff text was in a larger font, so I used the Inspector to reset the style of all similar text. I have checked all twelve movements from this work and this is the only remaining one at this stage that will not open. The message is: XML read error at line 56085 column 23.
File attached. Thanks.

Attachment Size
Cantata 9 Orchestra Sep2015 rev.mscz 58.43 KB

In reply to by KenS

Interestingly the latest nightly build can't read it either. Andway, it again is a matter of an & , this time in a staff text (measure 82, "Oboe & Flute", twice)
Fixed score attached

General recipe to fix: save as mscx, open with a plain text Editor, go to the line and column MuseScore complained about and remove the offending character or replace be e.g. +. Then open the score in MuseScore and replace it by an & again

Attachment Size
Cantata 9 Orchestra Sep2015 rev.mscz 58.02 KB

In reply to by Jojo-Schmitz

Or instead of removing the "&", replace it with "&" which is what was supoosed to have happend in the first place.

The bug reset to style is one of the know cases I mentioned above. It is fixed in current buikds, but fixed means, current builds won't *create* corrupt files like this any more. Already corrupted files still won't be able to open. I suspect that would be harder to fix since the score is no longer valid XML syntax.

I just got this bug now. MuseScore 2.0.3, I'd been editing a file yesterday, all ok then. When I came to open it today it gave this error and a line:col

Thank goodness for that is all I can say since it allowed me to fix the problem. I was able to rename the mscz file to a .zip file, open it, extract the mscx file from it, open that in visual studio, go to the line and column and fix the XML problem by hand.

The problem was a text item that had an unescaped ampersand (&) in it.

I'm fairly certain I didn't touch this text item for weeks, during which time the project had been saved many times.

There were other text items that properly escaped the &

So I'm not sure how this one got through, but at least I was able to recover from it. Maybe the parser on read could be a little more lenient, and finding an & followed by a space means unescaped &. XML sucks anyway IMO, it failed escaping 101 (it can't even escape CDATA end markers in CDATA content, and don't get me started about semantics of whitespace in values) so it's a broken format from the design. Maybe should use JSON instead.

Same problem, but I can't seem to open it in a text editor. Can anyone help? And please walk me through the steps if this happens again? I have a mac

Attachment Size
Crazy_Train.mscx 165.78 KB

In reply to by JIP14

The file that you attached is an MSCZ file that has been renamed to give it a different extension. That is not what is meant by "save it as MSCX". But no matter. An MSCZ file is a valid ZIP archive, so it can be renamed with a .zip extension and extracted with a double-click. The extracted MSCX file is what you want to edit with a text editor.

It is also possible to extract the MSCX without renaming the file, using the unzip command.

I went ahead and corrected your score for you, and I have attached it to this post.

Attachment Size
Crazy_Train.mscx 2.71 MB

Do you still have an unanswered question? Please log in first to post your question.