1 defmodule Pleroma.Web.XML do
4 def string_from_xpath(_, :error), do: nil
6 def string_from_xpath(xpath, doc) do
8 {:xmlObj, :string, res} = :xmerl_xpath.string('string(#{xpath})', doc)
15 if res == "", do: nil, else: res
18 Logger.debug("Couldn't find xpath #{xpath} in XML doc")
23 def parse_document(text) do
27 |> :binary.bin_to_list()
28 |> :xmerl_scan.string()
33 Logger.debug("Couldn't parse XML: #{inspect(text)}")