Fix XML parsing
This commit is contained in:
parent
a36dcc9535
commit
129061448a
|
@ -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
|
||||
{doc, _} =
|
||||
data
|
||||
|> :binary.bin_to_list()
|
||||
|> :xmerl_scan.string()
|
||||
|
||||
{:ok, doc}
|
||||
catch
|
||||
:exit, reason -> {:error, "parsing XML failed: #{inspect(reason)}"}
|
||||
end
|
||||
|
||||
doc
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue