Hi Matthieu,
I'm using sxmlc lib to read some xml. I receive an error parsing the xml attached. The call chain is:
XMLDoc_parse_buffer_DOM(.. , .. , &doc);
XMLDoc_root(&doc);
The problem is that when XMLDoc_parse_buffer_DOM fails, it calls XMLDoc_free(&doc) and, so, when I call XMLDoc_root it fails as doc is not initialized.
The error is returned by this last function, and is "simple:65: An error was found (UNEXPECTED_TAG_END), loading aborted..."
This error is identified in function _parse_data_SAX into if (txt_end == NULL) { } body.
After testing I've notice that the problem is the '+' char at the end of tag <msginerr>. If I remove it all works. So if there is a '+' char at the end of the value field of a tag, _parse_data_SAX fails.</msginerr>
Thanks for support,
Ermanno
Hi Ermanno,
Thank you for your report and the XML file. I will have a look asap.
Matthieu
Update: also if you replace the last '+' with '=' it not works.
Hi Ermanno,
The following code I am using works fine:
There is indeed a problem when the buffer is not NULL-terminated (if you remove the line marked with
<<<---). I will correct it by adding alenparameter.Could you paste the code you use that shows the error?
Thanks,
Matthieu
(which means I suspect the buffer you're parsing is just enough to contain the whole XML and is not null-terminated. Removing a character somewhere will make room for the null termination and make things work)
Hi Matthieu,
yesterday evening I detect the problem by debugging. I solve it by using a calloc instead of malloc, so that the buffer is already well terminated. So we are reaching the same problem.
Thanks,
Ermanno
v4.2.8 delivered.