parser return halt when the root tag is reached, all trailing content is skipped

This commit is contained in:
mmacia committed 2026-07-08 22:27:50 +00:00
1 parent 3e26df844b
commit cd698294c1
1 file changed
+11 -3
+11 -3
View File
@@ -92,9 +92,17 @@ defmodule FeedReader.Parser do
Saxy.parse_stream(input, format.handler(), state, character_data_max_length: chunk_size) Saxy.parse_stream(input, format.handler(), state, character_data_max_length: chunk_size)
case result do case result do
{:ok, _state} -> send(parent, {reference, :done}) {:ok, _state} ->
{:error, reason} -> send(parent, {reference, {:event, {:error, reason}}}) send(parent, {reference, :done})
{:halt, _state, _rest} -> send(parent, {reference, {:event, {:error, :parser_halted}}})
{:error, reason} ->
send(parent, {reference, {:event, {:error, reason}}})
{:halt, state, _rest} when is_map(state) and state.root_closed ->
send(parent, {reference, :done})
{:halt, _state, _rest} ->
send(parent, {reference, {:event, {:error, :parser_halted}}})
end end
end) end)