Understanding line numbers and column numbers in a message
I have a fatal error in line 139, column 101. But the line and column number does not exist in the XML file.
I had removed some measures to see if I could get around the error and narrow it down.
The original message is incorrectly coded content on line 155 column 69. That column does not exist in my file so I assume that line and column numbers are relative to something other than CRLF.
I have attached a file as created by my program.
thanks
Attachment | Size |
---|---|
JOB-017 (2).XML | 91.2 KB |
Comments
For me, it reports the error as line 155. But I also see the error itself is regarding the characer encoding. So my guess is any discrepanciy is caused by the encoding error itself - a newline that is not recognized as such because it isn't encoded properly, or the converse. My text editor doesn't like your file either, for the same reason.
I cannot advise how the the line and column numbers have been derived and it looks to me as if somehow the xml import gets confused and sends a wrong message.
I admit that the file has a mixture of almost all possible line ending combinations (LF, CR, CRLF) and I tried to convert all to one but it did not help. Then I tried to format it and have pumped the code through a [http://www.webtoolkitonline.com/xml-formatter.html|XML formatter] and suddenly it worked.
Non-breaking space (xA0) breaks xml import!
When you take a look in line 248 column 106, there is a character which is responsible for that strange behaviour, though I cannot explain why. It is a non-breaking space (xA0). Replacing this character with regular space fixes the problem and the score opens properly.
The non-breaking space [] is located in the following text:
In reply to I cannot advise how the the by .m.i.r.o.
Excellent diagnosis - thank you. I had imagined that I had some failure to close an XML tag in my generating program. I think that Musescore should handle a chr(255) or xA0 character - it's just data. So I won't worry about this. I could remove it in my program also.
thanks very much
In reply to Excellent diagnosis - thank by Bob MacDonald1
That is an absurd - the file is supposed to be valid XML, and your file claims to be UTF-8 encoded (that's what it claims in the header) - it's not "just data". The byte 0xA0 is not valid in that encoding.
That can easily checke dby running xmllint on the file:
{syntaxhighlighter shell}
$ xmllint JOB-017%20.XML
JOB-017%20.XML:234: parser error : Input is not proper UTF-8, indicate encoding !
Bytes: 0xA0 0x75 0x70 0x20
ve">You lay
{/syntaxhighlighter} ^
In reply to That is an absurd - the file by rmattes
It's not absurd - just my ignorance. So I failed to convert an ascii code to Unicode. I didn't know there was any incompatibility. I assumed they were upward compatible.
thanks
In reply to It's not absurd - just my by Bob MacDonald1
Ok, but be aware that your choosen character isn't even valid ASCII ;-) (ASCII is 7-Bit and would be indeed valid UTF-8). There is a non-breaking whitespace in Unicode at codepoint U+00A0 but that needs to be encoded as a two-byte sequence in UTF-8 ( 0xC2A0).
In reply to I cannot advise how the the by .m.i.r.o.
I am still confused about the coding. In my file, using notepad it is line 183 col 106.
Do you know why would the line number be smaller?
Also that character is not what I thought it was. There are no chr(255) characters in my data. So I was wrong about my guess as to where it had come from. Changing that character, whatever it is, fixes the problem.
There are times when I need a non-breaking space in my data - I probably should have a better way to do it. I type them as alt-255. I am guessing this creates a problem when they are copied from one field by Oracle into another. Or perhaps that the character is not usable in the new world.
If there is an expert on coding at that level who knows, I would be happy to hear about it. In any case, thanks very much for this accurate correction.
In reply to I am still confused about the by Bob MacDonald1
I'm not an expert on character encoding, although I feel your pain - it's not the world I grew up in (1970's!) either :-) and I always have to read up on it when I need to deal with it. Miostly we use text lbraries than handle this for us - not sure what your situation it.
Anyhow, I *can* suggest that if you want a non-breaking space, you try writing the XML entity for it: I don't really what you are trying to use it for, though, or that MsueScore would understand your intended use - the non-breaking space is mostly relevant only in a world that knows about word wrap, no?
In reply to I'm not an expert on by Marc Sabatella
Thank you Marc. The non breaking space is not required in this context. I was using it as a hack to distinguish certain classes of gloss in the translation from Hebrew which this music comes from. I have simply removed them from the data since the encoding is a mystery to me. If anyone is interested, the work I have done is to read the Hebrew text of the Leningrad codex via web service and convert it into MusicXML. More info here.