constant {hchars,hsubs} = columnize({{"<","<"},
{">",">"},
{"&","&"},
{"\"","""},
{"\'","'"}})
function xmlquote_all(sequence s)
for i=1 to length(s) do
s[i] = substitute_all(s[i],hchars,hsubs)
end for
return s
end function
function xml_CharacterRemarks(sequence data)
string res = "\n"
for i=1 to length(data) do
res &= sprintf(" %s\n",xmlquote_all(data[i]))
end for
return res & "\n"
end function
constant testset = {
{"April", "Bubbly: I'm > Tam and <= Emily"},
{"Tam O'Shanter", "Burns: \"When chapman billies leave the street ...\""},
{"Emily", "Short & shrift"}
}
printf(1,xml_CharacterRemarks(testset))
-- Sample output:
--
-- Bubbly: I'm > Tam and <= Emily
-- Burns: "When chapman billies leave the street ..."
-- Short & shrift
--