wood burning stoves 2.0*
The moose likes Other JSE/JEE APIs and the fly likes Problem in handling special characters using FOP generating pdf Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Other JSE/JEE APIs
Bookmark "Problem in handling special characters using FOP generating pdf" Watch "Problem in handling special characters using FOP generating pdf" New topic
Author

Problem in handling special characters using FOP generating pdf

venki janapati
Greenhorn

Joined: Dec 26, 2002
Posts: 19
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
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41108
    
  45
Is you XML well-formed and valid? If so, please post a minimal example of XML and XSL-FO that still exhibits the problem.


Ping & DNS - my free Android networking tools app
Chris Downey
Greenhorn

Joined: Jul 23, 2005
Posts: 4
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

Joined: Dec 26, 2002
Posts: 19
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
jaibardhan Ruwari
Greenhorn

Joined: Jul 18, 2010
Posts: 5
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.

 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Problem in handling special characters using FOP generating pdf
 
Similar Threads
Unicode parsing exception
Can FOP (Apache) translate a PDF back into ".fo"?
problem in handling special characters in XML using FOP
rendering TIF image in PDF
Help required regarding special character representation in PDF generated using FOP