XML special characters causing XOG error

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

Description:   

The following error is generated when I try to perform an XML Open Gateway (XOG) write action for my XML file, why?

Custom attribute record has not been inserted org.xml.sax.SAXParseException: The entity name must immediately follow the '&' in the entity reference

 

Solution:  

In this case, the XOG error was caused by the presence of a special character (ampersand, '&') in name field of a custom object that was exported to an XML document and imported to another system. Special characters (ampersand, apostrophe, less than, greater than and quote) prevent XML documents from conforming to XML syntax, known as "well-formed" documents. 

To resolve the error, rename the name field in the custom object to omit the special character. Any special characters in your XML document need to be replaced with their character entities (< & > " '). An easy way to do this is to use the "Search and Replace" function within your text editor.