WechatPay.Utils.XMLParser (WechatPay v0.10.0) View Source

Module to convert a XML string to map

Link to this section Summary

Functions

Convert the response XML string to map

Link to this section Functions

Link to this function

parse(xml_string, root_element \\ "xml")

View Source

Specs

parse(String.t(), String.t()) :: {:ok, map()} | {:error, WechatPay.Error.t()}

Convert the response XML string to map

Example

iex> WechatPay.Utils.XMLParser.parse("<xml><foo><![CDATA[bar]]></foo></xml>", "xml")
...> {:ok, %{foo: "bar"}}

iex> WechatPay.Utils.XMLParser.parse("<root><foo><![CDATA[bar]]></foo></root>", "root")
...> {:ok, %{foo: "bar"}}