Skip to content

Commit db13efd

Browse files
committed
Create child/0 type helper
This can help avoid doing too often `[exml:element() | exml:cdata()]` in specs.
1 parent a5a6548 commit db13efd

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

include/exml.hrl

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

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

1616
%% Implementation of the exmlAssertEqual/2 macro is a modification of
1717
%% https://github.com/erszcz/rxml/commit/e8483408663f0bc2af7896e786c1cdea2e86e43d#diff-2cb5d18741df32f4ead70c21fdd221d1

src/exml.erl

+2
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
-export_type([attrs/0,
3232
cdata/0,
3333
element/0,
34+
child/0,
3435
item/0]).
3536

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

0 commit comments

Comments
 (0)