Saxmerl (Saxmerl v0.1.0) View Source
Link to this section Summary
Link to this section Functions
Specs
Parses XML document into Erlang xmerl format.
Xmerl format requires tags and attribute names to be atoms. By default Saxmerl does not
create atoms dynamically, because it is dangerous. However, you can override this
behaviour by specifying dynamic_atoms?
to true
. Please check out String.to_atom/1
for more information about dynamic atom conversion.
Examples
iex> string = ~s(<foo bar="qwe"></foo>)
iex> Saxmerl.parse_string(string)
{:ok,
{:xmlElement,
:foo,
:foo,
[],
{:xmlNamespace, [], []},
[],
1,
[{:xmlAttribute, :bar, :bar, [], [], [], 1, [], 'qwe', :undefined}],
[],
[],
[],
:undeclared}}
Options
:dynamic_atoms?
- boolean, whether atoms should be created dynamically. Defaults tofalse
.:expand_entity
- specifies how external entity references should be handled. Three supported strategies respectively are::keep
- keep the original binary, for exampleOrange ®
will be expanded to"Orange ®"
, this is the default strategy.:skip
- skip the original binary, for exampleOrange ®
will be expanded to"Orange "
.{mod, fun, args}
- take the applied result of the specified MFA.