Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

exml:to_(pretty_)iolist/1 don't properly escape attribute values #9

Closed
erszcz opened this issue Feb 6, 2015 · 1 comment
Closed
Labels

Comments

@erszcz
Copy link
Member

erszcz commented Feb 6, 2015

Parsing is OK:

> {ok, T1} = exml:parse(<<"<el attr=\"''''\"/>">>).
{ok,{xmlel,<<"el">>,[{<<"attr">>,<<"''''">>}],[]}}

But printing the term and parsing it again fails:

> R1 = io_lib:format("~ts", [exml:to_iolist(T1)]).
> exml:parse(erlang:iolist_to_binary(R1)).
{error,{"not well-formed (invalid token)",
        <<"<stream><el attr=''''''/></stream>">>}}

What we get by printing is:

> erlang:iolist_to_binary(R1).
<<"<el attr=''''''/>">>

While what we should get is <<"<el attr='&apos;&apos;&apos;&apos;'/>">>. Just to make sure:

> exml:parse(<<"<el attr='&apos;&apos;&apos;&apos;'/>">>) =:= exml:parse(<<"<el attr=\"''''\"/>">>).
true

The same error applies to &quot; / ".

@erszcz
Copy link
Member Author

erszcz commented Mar 30, 2015

Fixed by #10.

@erszcz erszcz closed this as completed Mar 30, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant