When following error is obtained:
“Error Parsing XML: The entity name must immediately follow the ‘&’ in the entity reference.”,
Use the escapeSpecialChar function
function escapeSpecialChar(textvalue) {
try {
textvalue = textvalue.replace(/&/g, '&');
textvalue = textvalue.replace(/</g, '<');
textvalue = textvalue.replace(/>/g, '>');
textvalue = textvalue.replace(/'/g, '');
textvalue = textvalue.replaceAll("$", "");
log.debug('textvalue', textvalue)
return textvalue;
} catch (e) {
log.error({
title: e.name,
details: e
});
}
}