#1 No <> substitution in output values

closed
nobody
None
5
2006-09-29
2006-09-21
DataCompBoy
No

In written XML, values that contains < and > are dumped
wrong, without substitution to &lt; and &gt;
change erlsom_write:xmlString(String) to:

%% NOTE: this function is copied form DOM.ERL - it
should be in a separate module
%% returns a string with & replaced by &amp; and " by
&quot;
%% < replaced with &lt;
%% > replaced with &gt;
%% might be faster to parse the strings?
xmlString(String) ->
{ok, String2, _} = regexp:gsub(String, "&", "\\&amp;amp;
"),
{ok, String3, _} = regexp:gsub(String2, "<", "\\&amp;lt;
"),
{ok, String4, _} = regexp:gsub(String3, ">", "\\&amp;gt;
"),
{ok, Result, _} = regexp:gsub(String4, "\"",
"\\&amp;quot;"),
Result.

Discussion

  • DataCompBoy
    DataCompBoy
    2006-09-29

    • status: open --> closed