sebdel / mra-tools-c

39 stars 13 forks source link

More informative error message when attributes are not within inverted commas #53

Closed jotego closed 4 years ago

jotego commented 4 years ago

If I forget to use inverted commas for an attribute I get this message:

bash-4.1$ mra nemo_notest.mra -z zip

WE SHOULD NOT BE HERE!
[<patch offset=0x63c>]

nemo_notest.mra:20: An error was found (MEMORY(-1)), loading aborted...
nemo_notest.mra is not a valid xml file

Which is not very informative for the user. Could we have something that points out better to the problem in the XML file? Something like: Line xx is not a valid XML statement. Of course if you could go into details about why it is not valid, that's even better. But at least to put the focus at the file. Because a message with expressions such as An error was found (MEMORY(-1)) suggests a problem with the mra executable not with the input file.

Thank you

sebdel commented 4 years ago

The last line is my mine, the first 3 lines come from the xml parser. I'm afraid that's as good as it gets. sxmlc stands for small xml C, so there are trade offs.

I'll look into it though, the MEMORY(-1) message is wrong, the constant is actually called TAG_ERROR. And

WE SHOULD NOT BE HERE!
[<patch offset=0x63c>]

could be easily replaced by

Malformed xml tag: must be '<tag (attribName="attribValue")* [/]>' or '</tag>':
[<patch offset=0x63c>]