This error is to check for invalid XML characters [<, >, “, ‘, &] in the template. These characters need to be replaced with the corresponding Escape String as shown below.
< <
> >
” "
‘ '
& &
Using the below mentioned function, we can solve the issue.
function escapeXml(unsafe){
try{
if(unsafe) {
log.debug("inside escape");
return unsafe.replace(/[<>&'"]/g, function (c) {
switch (c) {
case '<':
return '<';
case '>':
return '>';
case '&':
return '&';
case '\'':
return ''';
case '"':
return '"';
}
});
}
}
catch (e) {
log.debug("error@unsafe", e.message)
}
}
Using this function in the variables, which store the special characcters.
Eg: obj.loc_address1=escapeXml(loc_address1);