Jump to content
Changes to the Jaspersoft community edition download ×

Error using < or > in my text on pdf output


thiego

Recommended Posts

I'm using iReport to create a pdf file with text from my database.

I can't use the characters < or > in my text because it's interpreted as a HTML tag creating the following error:

"ERROR [sTDERR] [Fatal Error] :3:2: The content of elements must consist of well-formed character data or markup."

Is there anything i could do to fix this problem?!

Thanks

Link to comment
Share on other sites

  • 1 month later...
  • Replies 2
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

thiego,

 

If you are using a textfield element inside of your report, you may use methods of the String class to find and replace these characters to allow them to display.

I had a similar problem, so I wrote a simple scriptlet to handle the case:

 

 

public String replaceChars(String s){

String replacedChars = "";

if (s.contains("<")){

replacedChars += s.replaceAll("<","<");

}

else if (s.contains(">")){

replacedChars += s.replaceAll(">', ">");

else if (s....)

 

return replacedChars;

}

 

The symbols '<' and '>' are html equivalents to < and >.

I know this solution is a little late, but hey, better late than never. :P Hope this helps...

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...