Skip to content

Commit

Permalink
Create child/0 type helper
Browse files Browse the repository at this point in the history
This can help avoid doing too often `[exml:element() | exml:cdata()]` in
specs.
  • Loading branch information
NelsonVides committed Jan 27, 2025
1 parent a5a6548 commit db13efd
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion include/exml.hrl
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

-record(xmlel, {name :: binary(),
attrs = #{} :: exml:attrs(),
children = [] :: [exml:element() | exml:cdata()]}).
children = [] :: [exml:child()]}).

%% Implementation of the exmlAssertEqual/2 macro is a modification of
%% https://github.com/erszcz/rxml/commit/e8483408663f0bc2af7896e786c1cdea2e86e43d#diff-2cb5d18741df32f4ead70c21fdd221d1
Expand Down
2 changes: 2 additions & 0 deletions src/exml.erl
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
-export_type([attrs/0,
cdata/0,
element/0,
child/0,
item/0]).

-type attrs() :: #{binary() => binary()}.
Expand All @@ -44,6 +45,7 @@
%% </ul>
-type element() :: #xmlel{}.
-type item() :: element() | cdata() | exml_stream:start() | exml_stream:stop().
-type child() :: element() | cdata().
-type prettify() :: pretty | not_pretty.
%% Printing indentation rule, see `to_iolist/2'.

Expand Down

0 comments on commit db13efd

Please sign in to comment.