diff --git a/src/exml.erl b/src/exml.erl index 9be2e4a..5cff94c 100644 --- a/src/exml.erl +++ b/src/exml.erl @@ -98,7 +98,7 @@ to_pretty_iolist(#xmlcdata{content = Content}, Level, Indent) -> attrs_to_iolist([], Acc) -> Acc; attrs_to_iolist([{Name, Value} | Rest], Acc) -> - attrs_to_iolist(Rest, [" ", Name, "='", Value, "'" | Acc]). + attrs_to_iolist(Rest, [" ", Name, "='", escape_attr(Value), "'" | Acc]). -spec parse(binary()) -> {ok, #xmlel{}} | {error, any()}. parse(XML) -> diff --git a/test/exml_stream_tests.erl b/test/exml_stream_tests.erl index 1744fca..b69df3e 100644 --- a/test/exml_stream_tests.erl +++ b/test/exml_stream_tests.erl @@ -121,3 +121,20 @@ cdata_test() -> assert_parses_escape_cdata(<<">>), assert_parses_escape_cdata(<<"