escape_xml_characters - darktable-org/lua-scripts GitHub Wiki
escape_xml_characters
escape characters for xml documents
local ds = require "lib/dtutils.string"
local result = ds.escape_xml_characters(str)
str - string - the string that needs escaped
escape_xml_characters provides the escape sequences for
"&", '"', "'", "<", and ">"
with the corresponding
"&",""", "'", "<", and ">"
.
result - string - the string containing escapes for the xml characters
https://stackoverflow.com/questions/1091945/what-characters-do-i-need-to-escape-in-xml-documents