escapeXml function
Escape text for XML tag content.
Implementation
String escapeXml(String text) {
return text
.replaceAll('&', '&')
.replaceAll('<', '<')
.replaceAll('>', '>')
.replaceAll('"', '"')
.replaceAll("'", ''');
}