View Source exml (exml v4.0.0)
Summary
Types
CDATA record. Printing escaping rules defaults to escaping character-wise.
Printing indentation rule, see to_iolist/2
.
Functions
Append new children elements to a element/0
.
Return the given element/0
with the specified filter passed over its children.
Insert a child by the given one, if none existed.
Parses a binary or a list of binaries into an XML element/0
.
Remove a given attribute from a element/0
.
Equivalent to to_iolist(Element, not_pretty).
Equivalent to erlang:binary_to_list(to_binary(Element)).
Equivalent to to_iolist(Element, pretty).
Replace or insert the value of a given attribute.
Replace or insert a child by the given one.
Calculate the length of the original XML payload
Sort in ascending order a list of xml item/0
.
Types
-type cdata() :: #xmlcdata{content :: iodata(), style :: escaped | cdata}.
CDATA record. Printing escaping rules defaults to escaping character-wise.
Escaping rules:
escaped
: escapes all characters by regular&
control escaping.cdata
: wraps the entire string into a<![CDATA[]]>
section.
-type element() :: #xmlel{name :: binary(), attrs :: exml:attrs(), children :: [exml:element() | exml:cdata()]}.
-type item() :: element() | attr() | cdata() | exml_stream:start() | exml_stream:stop().
-type prettify() :: pretty | not_pretty.
Printing indentation rule, see to_iolist/2
.
Functions
Append new children elements to a element/0
.
Return the given element/0
with the specified filter passed over its children.
Insert a child by the given one, if none existed.
Parses a binary or a list of binaries into an XML element/0
.
-spec remove_attr(exml:element(), binary()) -> element().
Remove a given attribute from a element/0
.
Return the given element/0
without any cdata/0
on its children.
-spec to_binary(exml_stream:element() | [exml_stream:element()]) -> binary().
Equivalent to erlang:iolist_to_binary(to_iolist(Element, not_pretty)).
-spec to_iolist(exml_stream:element() | [exml_stream:element()]) -> iodata().
Equivalent to to_iolist(Element, not_pretty).
-spec to_list(exml_stream:element() | [exml_stream:element()]) -> string().
Equivalent to erlang:binary_to_list(to_binary(Element)).
-spec to_pretty_iolist(exml_stream:element() | [exml_stream:element()]) -> iodata().
Equivalent to to_iolist(Element, pretty).
Replace or insert the value of a given attribute.
Replace or insert a child by the given one.
-spec xml_size(item() | [item()]) -> non_neg_integer().
Calculate the length of the original XML payload
-spec xml_sort([item()]) -> [item()]; (element()) -> element(); (attr()) -> attr(); (cdata()) -> cdata(); (exml_stream:start()) -> exml_stream:start(); (exml_stream:stop()) -> exml_stream:stop().
Sort in ascending order a list of xml item/0
.
Sorting is defined as calling lists:sort/1
at:
- all the
xmlel
s provided (if there is a list of them) AND - all the
xmlel
elements' attributes recursively (the root and descendants) AND - all the
xmlel
children recursively (the root and descendants).