18 lines
465 B
Elixir
18 lines
465 B
Elixir
|
defmodule FeedParser.XML do
|
||
|
import Record
|
||
|
|
||
|
defrecord :xmlElement, extract(:xmlElement, from_lib: "xmerl/include/xmerl.hrl")
|
||
|
defrecord :xmlAttribute, extract(:xmlAttribute, from_lib: "xmerl/include/xmerl.hrl")
|
||
|
defrecord :xmlText, extract(:xmlText, from_lib: "xmerl/include/xmerl.hrl")
|
||
|
|
||
|
@spec parse(data :: String.t()) :: tuple()
|
||
|
def parse(data) do
|
||
|
{doc, _} =
|
||
|
data
|
||
|
|> :binary.bin_to_list()
|
||
|
|> :xmerl_scan.string()
|
||
|
|
||
|
doc
|
||
|
end
|
||
|
end
|