Braintree v0.4.0 Braintree.XML

Simplified XML handling module that only supports dump and load.

Summary

Functions

Converts a map into the equivalent XML representation

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

Types

xml :: binary

Functions

dump(map)

Specs

dump(Map.t) :: xml

Converts a map into the equivalent XML representation.

Examples

iex> Braintree.XML.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>|
load(xml)

Specs

load(xml) :: Map.t

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

Examples

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