While integrating CRM orders to our custom financial system webservice I got error “An error occurred while parsing EntityName” in my plugin. Our custom financial service accepts xml string as input, so while sending data in xml form, sometime account name contains special character like ‘&’ which is a illigal character in xml.so I wrote below function to replace illigal characters in xml request
private string FormatText(string XmlRequest)
{
string _ModifiedXML = XmlRequest.Replace(“&”, “&”);
_ModifiedXML = _ModifiedXML.Replace(“”, “>”);
_ModifiedXML = _ModifiedXML.Replace(“‘”, “'”);
_ModifiedXML = _ModifiedXML.Replace(“””, “"”);
return _XmlRequest;
}
Hope it will help somebody !!!
var removeIllegalCharacters = function (xmlRequest) {
xmlRequest= replaceAll(xmlRequest, ‘&’, ”);
xmlRequest = replaceAll(xmlRequest, ‘>’, ”);
xmlRequest = replaceAll(xmlRequest, ‘<', '');
xmlRequest = replaceAll(xmlRequest, '"', '');
xmlRequest = replaceAll(xmlRequest, ''', '');
return xmlRequest;
};
var replaceAll = function(string, find, replace) {
return string.replace(new RegExp(find, 'g'), replace);
};