Braintree.XML.Encoder (Braintree v0.13.0)

XML encoding tailored to dumping Braintree compatible params.

Link to this section Summary

Functions

Converts a map into the equivalent XML representation.

Link to this section Types

@type xml() :: binary()

Link to this section Functions

@spec dump(map()) :: xml()

Converts a map into the equivalent XML representation.

examples

Examples

iex> Braintree.XML.Encoder.dump(%{a: %{b: 1, c: 2}})
~s|<?xml version="1.0" encoding="UTF-8" ?>\n<a>\n<b>1</b>\n<c>2</c>\n</a>|

iex> Braintree.XML.Encoder.dump(%{a: %{b: "<tag>"}})
~s|<?xml version="1.0" encoding="UTF-8" ?>\n<a>\n<b>&lt;tag&gt;</b>\n</a>|