xmerl_sax_parser:stream/2 doesn't know when to stop

Per Melin <>
Fri Nov 5 20:27:52 CET 2010

(I've only tested with R13B04 but there is nothing in the release
notes that indicates that this would be different in R14B.)

Without the continuation_fun option xmerl_sax_parser:stream/2 works as
I would expect. But with a continuation_fun it needs to be fed at
least one extra character after a complete document.

1> EventFun = fun(E, _, S) -> erlang:display(E), S end.
2> ContFun = fun(S) -> {io:get_line(">> "), S} end.
3> xmerl_sax_parser:stream("<foo />", [{event_fun, EventFun},
{continuation_fun, ContFun}]).

Here it has called ContFun and is waiting for additional input. It
will accept anything that is not whitespace, and then return it as a
rest. Let's give it an "x".

>> x

It seems this used to be a problem even without continuation_fun, but
the patch described here painted over it:

More information about the erlang-bugs mailing list