Solution for ERROR: 'The reference to entity "xyz" must end with the ';' delimiter.'
Ever tried parsing an xml and run into javax.xml.transform.TransformerException:
com.sun.org.apache.xml.internal.utils.WrappedRuntimeException: The reference to entity "xyz" must end with the ';' delimiter. Read on to find out what the issue could be and how to fix it.

Ever tried parsing an xml and run into javax.xml.transform.TransformerException:

com.sun.org.apache.xml.internal.utils.WrappedRuntimeException: The reference to entity "xyz" must end with the ';' delimiter. 

This usually happens when the input xml contains one of the xml characters that needs to be escaped.   Check your input xml for one of the characters within the bracket below:

(“, ‘, <, >, &)

If it is present then it would usually throw the parser out of sequence.  These characters need to be escaped before they can be parsed by the parser.   That brings up another interesting question.  How do we escape these characters.If you are using java, you can use the StringEscapeUtils class from commons lang package.  It has both an escapeHtml and unescapeHtml method that would encode the characters.  See below for an example:

String temp = “check & cash”;
temp = StringEscapeUtils.escapeHtml(temp);
System.out.println(temp) ;

Would produce an output of:

check & cash

This encoding would work with any xml parser.