The entity name should immediately follow "&" in the entity reference error in jasper reports

I have a main report that has 4 subheadings. A report is generated successfully when I create a report in iReport (version 4.1.3). However, when the report is deployed to the JBoss server, it gives the following error:

Error Parsing Styled Text "org.xml.sax.SAXParseException: The entity name must immediately follow the '&' in the entity reference jasper reports". 

The corresponding empty report, which has no mapping to datsource, was generated successfully. However, one that retrieves values ​​from the data source throws this error.

Could you tell me what could be the problem.

iReport version: 4.1.3

Data Source: XML Data Source

Please let me know if you need more information.

+6
source share
3 answers

I assume that your XML data source contains an "&" character in some data.

If so, replace '&' with & and try, it should work correctly.

PS: You must accept the answers if they help you. !!

EDIT: Check out this discussion on the JasperForge forum. Says the same

+18
source

Common in xml how to avoid errors:

  • ampersand (&) escaped to &
  • double quotes (") are reset to "
  • single quotes (') are reset to '
  • less than (<) shielded to . &lt; . &lt;
  • more than (>) is escaped to . &gt; . &gt;
+8
source

You should avoid the special character. You can look at StringEscapeUtils from the Apache Commons Lang library.

0
source

Source: https://habr.com/ru/post/918654/


All Articles