From 129061448a87661eef8d5d27ef742c6a7dcb7a48 Mon Sep 17 00:00:00 2001 From: Shadowfacts Date: Tue, 12 Apr 2022 11:42:17 -0400 Subject: [PATCH] Fix XML parsing --- lib/xml.ex | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/xml.ex b/lib/xml.ex index c61fc71..a8309d6 100644 --- a/lib/xml.ex +++ b/lib/xml.ex @@ -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