[erlang-questions] beginner: Generating HTML with ">" from Erlang

Bengt Kleberg <>
Fri Feb 14 07:00:39 CET 2014


I tried this with the official company browser(*) and Javascript in HTML
did not work with:
	if (i > 0) { ...


bengt
(*) Firefox 17

On Thu, 2014-02-13 at 18:35 +0400, Сергей Прохоров wrote:
> I'm sure, that embedded Javascript understands > and < instead
> of > and < characters, so
> 
> 
> <script>
> if (a &gt b) alert("a greater than b");
> </script>
> 
> 
> should work.
> 
> 
> You may also try Mochiweb's HTML parser/serializer, which is much
> simpler and faster, than xmerl
> https://github.com/mochi/mochiweb/blob/master/src/mochiweb_html.erl
> 
> 
> 
> Tree = {<<"html">>, [{<<"lang">>, <<"en">>}],
>             [...child tags...]},
> mochiweb_html:to_html(Tree).
> 
> 
> But I'm not sure if it escapes special characters.



More information about the erlang-questions mailing list