Fix XML parsing

This commit is contained in:
Shadowfacts 2022-04-12 11:42:17 -04:00
parent a36dcc9535
commit 129061448a
1 changed files with 6 additions and 6 deletions

View File

@ -11,15 +11,15 @@ defmodule FeedParser.XML do
@spec parse(data :: String.t()) :: {:ok, tuple()} | {:error, String.t()}
def parse(data) do
{doc, _} =
try do
try do
{doc, _} =
data
|> :binary.bin_to_list()
|> :xmerl_scan.string()
catch
:exit, reason -> {:error, "parsing XML failed: #{inspect(reason)}"}
end
doc
{:ok, doc}
catch
:exit, reason -> {:error, "parsing XML failed: #{inspect(reason)}"}
end
end
end