[Expat-discuss] How to deal with CR-LF at the end of a file

Karl Waclawek karl at waclawek.net
Fri Apr 16 11:53:01 EDT 2004


> I use expat 1.95.7 on windows platform in C++.
> 
> I create my xml file manualy using fprint and I dont put a cr-lf after the
> last closing tag.
> This works fine exept that if I send the xml file by email there is a cr-lf
> added at the end of the file (after the last closing tag)
> When I try to read that file (with an extra cr-lf at the end) I get a "not
> well formed (invalid token)" error when expat try to read pass the last
> closing tag. Shoud I abort the parsing when I reach my last closing tag?


I am not sure if whitespace after the end tag is allowed,
but I almost think it is. Can you check if there is more
than just CR-LF, maybe a null character?

If there is, you should get rid of it.
Also, if sent as an e-mail attachment there should not be such a problem.
Aborting is possible too, but not a clean solution.

Karl



More information about the Expat-discuss mailing list