The entity name must immediately follow the '&' in the entity reference

Document ID : KB000049047
Last Modified Date : 14/02/2018
Show Technical Document Details

Description:

If information pulled from another location, such as Service Desk contains a special character and is handled in a Pre or Post execution code script PAM will interpret the character as is and will cause an error to occur similar to:

Error Message: org.xml.sax.SAXParseException: The entity name must immediately follow the '&' in the entity reference

Solution:

This is because PAM is not encoding the special characters in anyway and they must be encoded prior to use in a similar way to the following examples:

Process.outputString = Process.inputString.replace(/&/g, "&"); 	
Process.outputString = Process.outputString.replace(/</g, "&lt;"); 	
Process.outputString = Process.outputString.replace (/>/g, "&gt;"); 	
Process.outputString = Process.outputString.replace (/"/g, "&quot;"); 	
Process.outputString = Process.outputString.replace (/'/g, "&apos;");     
21104545-1=

Please note, inputString and outputString are arbitrary names, and this does not need to be a process level variable. This will replace "< , > , &", etc with the proper entity reference for each character. For example, & becomes &amp; and < becomes &lt;.