my dog learned polymorphism*
The moose likes XML and Related Technologies and the fly likes Using FOP Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "Using FOP" Watch "Using FOP" New topic
Author

Using FOP

Mark Spritzler
ranger
Sheriff

Joined: Feb 05, 2001
Posts: 17249
    
    6

OK, I have a Servlet that can take form parameters, do a query to the database, make the data into XML, and uses XSLT To transform it into HTML which is sends back through the HTTPServletResponse object. This works perfectly.
Now I am trying to transform that same XML using XSL:FO to become a PDF document that gets sent to the browser via the HTTPServletResponse.
The big problem is that in order to do this FOP requires any object you send to it as being a File. You can't pass InputStream, or StreamSource or Source objects. Well my data, except for the XSL file used to transform the XML to FO, is in streams and not saved in files. I don't want them to be in files because this is ad-hoc, and temp files don't work because multiple users might overwrite even temp files.
Here's my servlet code

You will notice in renderPDF, I gave up and said OK, OK if you have to have a file, I will make one. But it still doesn't work.
Thanks
Mark


Perfect World Programming, LLC - Two Laptop Bag - Tube Organizer
How to Ask Questions the Smart Way FAQ
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12761
    
    5
Cocoon manages this without writing a separate document file. You might take a look at how they do it xml.apache.org/cocoon/
Bill
Mark Spritzler
ranger
Sheriff

Joined: Feb 05, 2001
Posts: 17249
    
    6

Thanks Bill.
I also am seeing that FOP also has to use Avalon's Logging, and you need to have that package as well to get it to work.
I am going to look at Cocoon. Hopefully it is more intuitive that FOP.
Mark
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Using FOP
 
Similar Threads
Servlet, XML response and XSL
https problem
URGENT!!!! Xalan problem in Servlet with JRun
transforming xml from string source
problem in XSL Transformation