Merge branch 'develop' into dtluna/pleroma-feature/unfollow-activity
[akkoma] / lib / pleroma / web / xml / xml.ex
1 defmodule Pleroma.Web.XML do
2 def string_from_xpath(xpath, doc) do
3 {:xmlObj, :string, res} = :xmerl_xpath.string('string(#{xpath})', doc)
4
5 res = res
6 |> to_string
7 |> String.trim
8
9 if res == "", do: nil, else: res
10 end
11
12 def parse_document(text) do
13 {doc, _rest} = text
14 |> :binary.bin_to_list
15 |> :xmerl_scan.string
16
17 doc
18 end
19 end