View Source exml (exml v3.2.0)

Link to this section Summary

Link to this section Types

-type attr() :: {binary(), binary()}.
-type cdata() :: #xmlcdata{}.
-type element() :: #xmlel{}.
-type item() :: element() | attr() | cdata() | exml_stream:start() | exml_stream:stop().
-type prettify() :: pretty | not_pretty.

Link to this section Functions

-spec parse(binary() | [binary()]) -> {ok, exml:element()} | {error, any()}.
-spec to_binary(element() | [exml_stream:element()]) -> binary().

Equivalent to erlang:iolist_to_binary(to_iolist(Element, not_pretty)).

-spec to_iolist(element() | [exml_stream:element()]) -> iodata().

Equivalent to to_iolist(Element, not_pretty).

-spec to_list(element() | [exml_stream:element()]) -> string().

Equivalent to erlang:binary_to_list(to_binary(Element)).

Link to this function

to_pretty_iolist(Element)

View Source
-spec to_pretty_iolist(element() | [exml_stream:element()]) -> iodata().

Equivalent to to_iolist(Element, pretty).

-spec xml_size(item() | [item()]) -> non_neg_integer().
-spec xml_sort(item() | [item()]) -> item() | [item()].

Sort a (list of) xmlel().

Sorting is defined as calling lists:sort/1 at: * all the xmlels 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). The order is ascending.

The implementation of this function is a subtle modification of https://github.com/erszcz/rxml/commit/e8483408663f0bc2af7896e786c1cdea2e86e43d