Braintree.XML.Entity (Braintree v0.13.0)

XML entity conversion for known entities.

Link to this section Summary

Functions

Replace all escaped HTML entities, except those that would produce invalid XML

Encode all illegal XML characters by replacing them with corresponding entities.

Link to this section Functions

@spec decode(String.t()) :: String.t()

Replace all escaped HTML entities, except those that would produce invalid XML

examples

Examples

iex> Braintree.XML.Entity.decode("<tag>")
"<tag>"

iex> Braintree.XML.Entity.decode("Søren")
"Søren"

iex> Braintree.XML.Entity.decode("Normal")
"Normal"

iex> Braintree.XML.Entity.decode("First & Last")
"First & Last"

iex> Braintree.XML.Entity.decode(""air quotes"")
~s("air quotes")
@spec encode(String.t()) :: String.t()

Encode all illegal XML characters by replacing them with corresponding entities.

examples

Examples

iex> Braintree.XML.Entity.encode("<tag>")
"&lt;tag&gt;"

iex> Braintree.XML.Entity.encode("Here & There")
"Here &amp; There"