Win a copy of 97 Things Every Java Programmer Should Know this week in the Java in General forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Jeanne Boyarsky
  • Junilu Lacar
  • Henry Wong
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Frits Walraven
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • salvin francis
  • fred rosenberger

Problem in handling special characters using FOP generating pdf

 
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,
I am getting some special characters into DOM while creating bcos the data is having special chars in database. when i render PDF using FOP it gives following error:
FOPException an invalid character in XML .
can some one suggest what i can do

Thanks for help in advance
 
Rancher
Posts: 43016
76
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is you XML well-formed and valid? If so, please post a minimal example of XML and XSL-FO that still exhibits the problem.
 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I had a similar problem with another tool that created PDF's. You need capture the special char and translate it to unicode.
 
venki janapati
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
it stores the special character properly in DB. once i add this value as attibute to DOM. after applying transformer and i store the output in the file, itis ocnverted to the special character in DB is ♂. I am guessing the problem is in the transformer. i tried to use encoding in trnaformer like trnasformer.setoutputproperty(outputkey.encoding,"utf-8")

it didnt help anything
 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This exception is due to your data contained some Special characters which is not supported by Parser while rendering into PDF Through FOP Engine.
1) Passed encoding characterless while generating XML or
2) Replace all possible special characters from XML Data while reading XML or
3) Replace these from Database completely.

FileWriter fWriter = new OutputStreamWriter(new FileOutputStream(xmlfileName), "UTF-8");


Replace these charcters at run time from XML data.

 
You save more money with a clothesline than dozens of light bulb purchases. Tiny ad:
Devious Experiments for a Truly Passive Greenhouse!
https://www.kickstarter.com/projects/paulwheaton/greenhouse-1
    Bookmark Topic Watch Topic
  • New Topic