Jump to content
We've recently updated our Privacy Statement, available here ×

The entity "nbsp" was referenced, but not declared


Recommended Posts

Hi All,

I am using crosstab and in one of the text fields I set the markup="html".

The data passed to the text field is something like : <a href=" http://www.google.com/"/>, and it is coverted in my report to <a href="  http://www.google.com/"/> and causes the following exception:

 

018-03-30 01:14:43,930 ERROR n.s.j.e.util.JRStyledTextParser - Error parsing styled text.
org.xml.sax.SAXParseException: The entity "nbsp" was referenced, but not declared.
    at org.apache.xerces.util.ErrorHandlerWrapper.createSAXParseException(Unknown Source)
    at org.apache.xerces.util.ErrorHandlerWrapper.fatalError(Unknown Source)
    at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source)
    at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source)
    at org.apache.xerces.impl.XMLScanner.reportFatalError(Unknown Source)
    at org.apache.xerces.impl.XMLScanner.scanAttributeValue(Unknown Source)
    at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanAttribute(Unknown Source)
    at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanStartElement(Unknown Source)
    at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source)
    at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
    at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
    at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
    at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
    at org.apache.xerces.parsers.DOMParser.parse(Unknown Source)
    at org.apache.xerces.jaxp.DocumentBuilderImpl.parse(Unknown Source)
    at net.sf.jasperreports.engine.util.JRStyledTextParser.parse(JRStyledTextParser.java:235)
    at net.sf.jasperreports.engine.util.JRStyledTextParser.getStyledText(JRStyledTextParser.java:268)
    at net.sf.jasperreports.engine.fill.JRFillTextElement.getStyledText(JRFillTextElement.java:608)
    at net.sf.jasperreports.engine.fill.JRFillTextElement.getText(JRFillTextElement.java:640)

 

Does anyone have any idea how to fix this?

 

Thanks in advance

Link to comment
Share on other sites

  • Replies 4
  • Created
  • Last Reply

Top Posters In This Topic

In case your html text is stored in a parameter (for instance $P{HtmlText}), then try to use

$P{HtmlText}.replaceAll(" http:","http:")

in your textfield expression, instead of $P{HtmlText}. Try similar expressions if the html content is stored in field or variable.

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...