arunize Posted October 6, 2006 Share Posted October 6, 2006 Dear All,I am printing some text in a Field. Along with text it contains "&" symbol. While generating report it throw some exceptions. How can I avoid this? Regards,Arunagiri.K Link to comment Share on other sites More sharing options...
rsilverns.sympatico.ca Posted October 7, 2006 Share Posted October 7, 2006 Can you list the expression in the field along with the exception it throws please? Robin Link to comment Share on other sites More sharing options...
arunize Posted October 9, 2006 Author Share Posted October 9, 2006 rsilver@bfm.bm wrote:Can you list the expression in the field along with the exception it throws please?RobinMy Field is"<style isBold="true">"+ "GROSS : " + "</style>" + $F{gross}.replaceAll("t", " ") I passed value for gross is"5.5cms in length & 0.5cms in dia" My Error is[Fatal Error] :1:102: The entity name must immediately follow the '&' in the entity reference.09 Oct 2006 10:32:59,550 WARN JRFillTextElement [AWT-EventQueue-0][]: Invalid styled text.org.xml.sax.SAXParseException: The entity name must immediately follow the '&' in the entity reference. at com.sun.org.apache.xerces.internal.parsers.DOMParser.parse(DOMParser.java:264) at com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:292) at net.sf.jasperreports.engine.util.JRStyledTextParser.parse(JRStyledTextParser.java:133) at net.sf.jasperreports.engine.fill.JRFillTextElement.getStyledText(JRFillTextElement.java:453) at net.sf.jasperreports.engine.fill.JRFillTextElement.getText(JRFillTextElement.java:479) at ......java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4212) at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3892) at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3822)[Fatal Error] :1:102: The entity name must immediately follow the '&' in the entity reference. at java.awt.Container.dispatchEventImpl(Container.java:2010) at java.awt.Window.dispatchEventImpl(Window.java:1774) at java.awt.Component.dispatchEvent(Component.java:3803) at ....Post edited by: arunize, at: 2006/10/09 05:10 Link to comment Share on other sites More sharing options...
arunize Posted October 9, 2006 Author Share Posted October 9, 2006 Hey I got the solution Use & to print the & . I used like this$F{gross}.replaceAll("&","&") Thanks Arunagiri.K Link to comment Share on other sites More sharing options...
jo_atman Posted October 11, 2006 Share Posted October 11, 2006 Sorry, i guess i started a new topic about the same issue without searching the forum. I did the same thing replaceAll("&", "&"),but still got the error. the only difference is that i do this replaceAll in my data source... I'm also confused as to how you were able to show the escape sequence on the forum, since my escape sequence gets converted into an ampersand! Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now