Braintree.XML.Decoder (Braintree v0.13.0)

XML dumping tailored to encoding params sent by Braintree.

Link to this section Summary

Functions

Converts an XML document, or fragment, into a map. Type annotation attributes are respected, but all other attributes are ignored.

Link to this section Types

@type xml() :: binary()

Link to this section Functions

@spec load(xml()) :: map()

Converts an XML document, or fragment, into a map. Type annotation attributes are respected, but all other attributes are ignored.

examples

Examples

iex> Braintree.XML.Decoder.load("<a><b type='integer'>1</b><c>2</c></a>")
%{"a" => %{"b" => 1, "c" => "2"}}

iex> Braintree.XML.Decoder.load("<a><b type='string'>Jos&#233;</b></a>")
%{"a" => %{"b" => "José"}}

iex> Braintree.XML.Decoder.load("<a><b type='string'>First &amp; Last</b></a>")
%{"a" => %{"b" => "First & Last"}}

iex> Braintree.XML.Decoder.load("<a><b type='string'>&quot;air quotes&quot;</b></a>")
%{"a" => %{"b" => ~s("air quotes")}}