Hi,
Not sure what the problem is here. Do you want to turn off those exceptions in the logs, or do you actually want to have a valid markup text with ampersand in it?
First of all, the simple expression with a single ampersand character in it is not a valid styled text value. Styled text must be valid XML content, except only for an optional root tag, which is added automatically by JR when processing the value. The single "&" is not valid XML content because ampersand is special XML character and needs to be escaped, so the attempt to parse it as XML obviously fails.
If styled text parsing failures don't need to appear in your logs, then you can turn them off using your preferred logging library configuration.
For example, if you use log4j, you could add this line to the log4j.properties in your classpath:
log4j.logger.net.sf.jasperreports.engine.util.JRStyledTextParser=OFF
If the problem is the presence of ampersand characters in styled text, then it is important to know where the value is coming from. Does the ampersand need to be hardcoded in the JRXML expression like above, or is it actually coming from the value of a report field or parameter?
If I wanted to write Tom & Jerry, first in red and the second in blue, I could use this expression:
"<style forecolor=\"red\">Tom</style> & <style forecolor=\"blue\">Jerry</style>"
Having said that, if your text is coming from a database and it contains ampersand, if it is not valid XML already, you need to pre-process it and escape ampersands with & as seen above.
I hope this helps,
Teodor