RE: Need Working Sample

2001-07-09 Thread Michiel Verhoef

Just a thought but what you seem to want is the XML file processed by XSL
(which can be on disk).

Have you checked the docs/examples for Xalan, the XSLT processor oncluded
with FOP?
Because that is what you've been asking for: how dow I process my XML file
using my XSLT
stylesheet.

Sorry, no Java programmer so I can't give any techie tips but I'd go and
have a look at the Xalan
docs and examples if I were you..

Good luck,

Michiel


$ -Original Message-
$ From: Jim Urban [mailto:[EMAIL PROTECTED]]
$ Sent: vrijdag 6 juli 2001 17:52
$ To: [EMAIL PROTECTED]
$ Subject: RE: Need Working Sample
$ 
$ 
$ Sorry, but this does not work for two reasons.
$ 
$ 1. The XML does NOT exist on disk!  It is in memory only, and 
$ writing it to
$ disk is NOT an option.
$ 
$ 2. This is a high traffic web application.  Starting a new 
$ JVM to process
$ FOP is too costly.
$ 
$ There must be a way for this FOP thing to read raw (data only) XML (in
$ memory) apply an XSL style sheet to add the FO tags, then 
$ format the PDF and
$ return it to a browser.  I can't believe I am the first 
$ person in the word
$ to need to do this.
$ 
$ If I seem upset, I'm sorry.  But I have been fighting with 
$ FOP since last
$ week to get it to do this.  FOP works great for taking FO files and
$ converting them to PDF files, but that's not what I have to 
$ do.  I have a
$ deadline to meet and I have wasted a week trying to get FOP to work.
$ 
$ Jim
$ 
$ -Original Message-
$ From: Wolf Gustavo (SGC-EXT) [mailto:[EMAIL PROTECTED]]
$ Sent: Friday, July 06, 2001 10:11 AM
$ To: '[EMAIL PROTECTED]'
$ Subject: RE: Need Working Sample
$ 
$ 
$ Hi Jim,
$ I have exactly the same problem, and I've just found a non
$ elegant, working solution:
$ 
$ I generate my XML file, and then call the command line Fop 
$ from within my
$ servlet:
$ 
$ Runtime.getRuntime().exec(new String[]{java.exe, -cp,
$ c:\\fop\\Fop-0.18.1-DEV\\fop.jar;c:\\fop\\Fop-0.18.1-DEV\\lib
$ \\w3c.jar;c:\\
$ fop\\Fop-0.18.1-DEV\\lib\\xalan-2.0.0.jar;c:\\fop\\Fop-0.18.1-
$ DEV\\lib\\xerc
$ es-1.2.3.jar;c:\\fop\\Fop-0.18.1-DEV\\lib\\jimi-1.0.jar,
$ org.apache.fop.apps.Fop, -xml , c:\\prueba.xml, -xsl ,
$ c:\\prueba.xsl, -pdf , c:\\prueba.pdf});
$ 
$ As I said, it is NOT elegant, but after sweating for days 
$ with problems of
$ all type doing the elegant thing, I get my beautiful PDF on disk.
$ 
$ Of course you should adapt the names of trhe directories  and 
$ the xml and
$ xsl files.
$ 
$ Cheers,
$Gustavo
$ 
$ PS: if someone has an elegant solution I would be happy to use it too.
$ 
$   -Message d'origine-
$  De :Jim Urban [mailto:[EMAIL PROTECTED]]
$  Envoyé :vendredi, 6. juillet 2001 17:09
$  À : [EMAIL PROTECTED]
$  Objet : Need Working Sample
$ 
$  Hi, I am new to FOP.  I have a servlet which dynamically 
$ generates XML.  I
$  need to apply an XSL stylesheet containing FO tags to generate a FO
$  version of the XML and then I need to run this FO version of the XML
$  through FOP (or Driver) so the servlet can return a 
$ dynamically created
$  PDF to the browser.  Does anyone have a working example of 
$ how to do this?
$  Only the XSL style sheet containing the FO tags used in the initial
$  transform will be on disk.  Please help, I have to get this working.
$ 
$  Thanks,
$ 
$  Jim Urban
$  Product Manager
$  Netsteps Inc.
$  Suite 505E
$  1 Pierce Pl.
$  Itasca, IL  60143
$  Voice:  (630) 250-3045 x2164
$  Fax:  (630) 250-3046
$ 
$   Fichier: ATT14204.txt
$ 
$ -
$ To unsubscribe, e-mail: [EMAIL PROTECTED]
$ For additional commands, email: [EMAIL PROTECTED]
$ 
$ 
$ 
$ -
$ To unsubscribe, e-mail: [EMAIL PROTECTED]
$ For additional commands, email: [EMAIL PROTECTED]
$ 

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]




Re: Need Working Sample

2001-07-06 Thread Cyril Rognon

There is a FOP servlet example in the distribution of FOP :

/docs/examples/embedding/FopServlet.java

I think it will answer all the beginners questions.
See the example section on the FOP site to see all pre-answered question 
you might have in your beginning journey.
(starting with http://xml.apache.org/fop/embedding.html)

Cyril

At 10:08 06/07/01 -0500, you wrote:
Hi, I am new to FOP.  I have a servlet which dynamically generates XML.  I
need to apply an XSL stylesheet containing FO tags to generate a FO version
of the XML and then I need to run this FO version of the XML through FOP (or
Driver) so the servlet can return a dynamically created PDF to the browser.
Does anyone have a working example of how to do this?  Only the XSL style
sheet containing the FO tags used in the initial transform will be on disk.
Please help, I have to get this working.

Thanks,


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]




RE: Need Working Sample

2001-07-06 Thread Wolf Gustavo (SGC-EXT)

Hi Jim,
I have exactly the same problem, and I've just found a non
elegant, working solution:

I generate my XML file, and then call the command line Fop from within my
servlet:

Runtime.getRuntime().exec(new String[]{java.exe, -cp,
c:\\fop\\Fop-0.18.1-DEV\\fop.jar;c:\\fop\\Fop-0.18.1-DEV\\lib\\w3c.jar;c:\\
fop\\Fop-0.18.1-DEV\\lib\\xalan-2.0.0.jar;c:\\fop\\Fop-0.18.1-DEV\\lib\\xerc
es-1.2.3.jar;c:\\fop\\Fop-0.18.1-DEV\\lib\\jimi-1.0.jar,
org.apache.fop.apps.Fop, -xml , c:\\prueba.xml, -xsl ,
c:\\prueba.xsl, -pdf , c:\\prueba.pdf}); 

As I said, it is NOT elegant, but after sweating for days with problems of
all type doing the elegant thing, I get my beautiful PDF on disk.

Of course you should adapt the names of trhe directories  and the xml and
xsl files.

Cheers,
   Gustavo

PS: if someone has an elegant solution I would be happy to use it too. 

  -Message d'origine-
 De :  Jim Urban [mailto:[EMAIL PROTECTED]] 
 Envoyé :  vendredi, 6. juillet 2001 17:09
 À :   [EMAIL PROTECTED]
 Objet :   Need Working Sample
 
 Hi, I am new to FOP.  I have a servlet which dynamically generates XML.  I
 need to apply an XSL stylesheet containing FO tags to generate a FO
 version of the XML and then I need to run this FO version of the XML
 through FOP (or Driver) so the servlet can return a dynamically created
 PDF to the browser.  Does anyone have a working example of how to do this?
 Only the XSL style sheet containing the FO tags used in the initial
 transform will be on disk.  Please help, I have to get this working.
 
 Thanks,
 
 Jim Urban
 Product Manager
 Netsteps Inc.
 Suite 505E
 1 Pierce Pl.
 Itasca, IL  60143
 Voice:  (630) 250-3045 x2164
 Fax:  (630) 250-3046
 
  Fichier: ATT14204.txt 

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]




RE: Need Working Sample

2001-07-06 Thread Jim Urban

Sorry, but this does not work for two reasons.

1. The XML does NOT exist on disk!  It is in memory only, and writing it to
disk is NOT an option.

2. This is a high traffic web application.  Starting a new JVM to process
FOP is too costly.

There must be a way for this FOP thing to read raw (data only) XML (in
memory) apply an XSL style sheet to add the FO tags, then format the PDF and
return it to a browser.  I can't believe I am the first person in the word
to need to do this.

If I seem upset, I'm sorry.  But I have been fighting with FOP since last
week to get it to do this.  FOP works great for taking FO files and
converting them to PDF files, but that's not what I have to do.  I have a
deadline to meet and I have wasted a week trying to get FOP to work.

Jim

-Original Message-
From: Wolf Gustavo (SGC-EXT) [mailto:[EMAIL PROTECTED]]
Sent: Friday, July 06, 2001 10:11 AM
To: '[EMAIL PROTECTED]'
Subject: RE: Need Working Sample


Hi Jim,
I have exactly the same problem, and I've just found a non
elegant, working solution:

I generate my XML file, and then call the command line Fop from within my
servlet:

Runtime.getRuntime().exec(new String[]{java.exe, -cp,
c:\\fop\\Fop-0.18.1-DEV\\fop.jar;c:\\fop\\Fop-0.18.1-DEV\\lib\\w3c.jar;c:\\
fop\\Fop-0.18.1-DEV\\lib\\xalan-2.0.0.jar;c:\\fop\\Fop-0.18.1-DEV\\lib\\xerc
es-1.2.3.jar;c:\\fop\\Fop-0.18.1-DEV\\lib\\jimi-1.0.jar,
org.apache.fop.apps.Fop, -xml , c:\\prueba.xml, -xsl ,
c:\\prueba.xsl, -pdf , c:\\prueba.pdf});

As I said, it is NOT elegant, but after sweating for days with problems of
all type doing the elegant thing, I get my beautiful PDF on disk.

Of course you should adapt the names of trhe directories  and the xml and
xsl files.

Cheers,
   Gustavo

PS: if someone has an elegant solution I would be happy to use it too.

  -Message d'origine-
 De :  Jim Urban [mailto:[EMAIL PROTECTED]]
 Envoyé :  vendredi, 6. juillet 2001 17:09
 À :   [EMAIL PROTECTED]
 Objet :   Need Working Sample

 Hi, I am new to FOP.  I have a servlet which dynamically generates XML.  I
 need to apply an XSL stylesheet containing FO tags to generate a FO
 version of the XML and then I need to run this FO version of the XML
 through FOP (or Driver) so the servlet can return a dynamically created
 PDF to the browser.  Does anyone have a working example of how to do this?
 Only the XSL style sheet containing the FO tags used in the initial
 transform will be on disk.  Please help, I have to get this working.

 Thanks,

 Jim Urban
 Product Manager
 Netsteps Inc.
 Suite 505E
 1 Pierce Pl.
 Itasca, IL  60143
 Voice:  (630) 250-3045 x2164
 Fax:  (630) 250-3046

  Fichier: ATT14204.txt

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]




RE: Need Working Sample

2001-07-06 Thread Wolf Gustavo (SGC-EXT)

Hi Erik,
 I have tried your stuff, but it still gives me the same problem i
have since two days after I try to instantiate the parser:

javax.xml.transform.TransformerConfigurationException: Namespace not
supported by SAXParser
Error msg: null

At the risk of looking abusive, could someone take a look at the xml and xsl
files (they are really short examples that work with Fop as a line command,
and I'll invite a beer to whomever comes to Geneva (CH, not IL) to pick it
up)?

They are attached once more.

Really thanks, and sorry to know that Jim cannot use my non-elegant
solution. I am fighting this stuff for days also and I have to finish my
project by next Friday.



-Message d'origine-
De : Erik Rehrmann [mailto:[EMAIL PROTECTED]]
Envoyé : vendredi, 6. juillet 2001 17:26
À : '[EMAIL PROTECTED]'
Objet : AW: Need Working Sample


Hi Gustavo,

the following works great:

  ByteArrayOutputStream out = new ByteArrayOutputStream();
  Driver driver = new Driver();
  driver.setRenderer(Driver.RENDER_PDF);
  InputHandler inputHandler = new XSLTInputHandler(xmlFile, xslFile);
  org.xml.sax.XMLReader parser = inputHandler.getParser();
  driver.buildFOTree(parser, inputHandler.getInputSource());
  driver.format();
  driver.setOutputStream(out);
  driver.render();

  response.setContentType(application/pdf);
  byte[] content = out.toByteArray();
  response.setContentLength(content.length);
  response.getOutputStream().write(content);
  response.getOutputStream().flush();

This example lets the servlet stream the result directly to the client
browser. If you want to have the pdf file on your disk instead, just write
use an other output stream!

It currently does not work for IE5.5, but I'll check the hint of Alex
McLintock earlier in this list.

Hope this helps you out,
___
Erik Rehrmann - IOn AG
[EMAIL PROTECTED]




 -Ursprüngliche Nachricht-
 Von: Wolf Gustavo (SGC-EXT) [mailto:[EMAIL PROTECTED]]
 Gesendet: Freitag, 6. Juli 2001 17:11
 An: '[EMAIL PROTECTED]'
 Betreff: RE: Need Working Sample
 
 
 Hi Jim,
 I have exactly the same problem, and I've just found a non
 elegant, working solution:
 
 I generate my XML file, and then call the command line Fop 
 from within my
 servlet:
 
 Runtime.getRuntime().exec(new String[]{java.exe, -cp,
 c:\\fop\\Fop-0.18.1-DEV\\fop.jar;c:\\fop\\Fop-0.18.1-DEV\\lib
 \\w3c.jar;c:\\
 fop\\Fop-0.18.1-DEV\\lib\\xalan-2.0.0.jar;c:\\fop\\Fop-0.18.1-
 DEV\\lib\\xerc
 es-1.2.3.jar;c:\\fop\\Fop-0.18.1-DEV\\lib\\jimi-1.0.jar,
 org.apache.fop.apps.Fop, -xml , c:\\prueba.xml, -xsl ,
 c:\\prueba.xsl, -pdf , c:\\prueba.pdf}); 
 
 As I said, it is NOT elegant, but after sweating for days 
 with problems of
 all type doing the elegant thing, I get my beautiful PDF on disk.
 
 Of course you should adapt the names of trhe directories  and 
 the xml and
 xsl files.
 
 Cheers,
Gustavo
 
 PS: if someone has an elegant solution I would be happy to 
 use it too. 
 
   -Message d'origine-
  De :Jim Urban [mailto:[EMAIL PROTECTED]] 
  Envoyé :vendredi, 6. juillet 2001 17:09
  À : [EMAIL PROTECTED]
  Objet : Need Working Sample
  
  Hi, I am new to FOP.  I have a servlet which dynamically 
 generates XML.  I
  need to apply an XSL stylesheet containing FO tags to generate a FO
  version of the XML and then I need to run this FO version of the XML
  through FOP (or Driver) so the servlet can return a 
 dynamically created
  PDF to the browser.  Does anyone have a working example of 
 how to do this?
  Only the XSL style sheet containing the FO tags used in the initial
  transform will be on disk.  Please help, I have to get this working.
  
  Thanks,
  
  Jim Urban
  Product Manager
  Netsteps Inc.
  Suite 505E
  1 Pierce Pl.
  Itasca, IL  60143
  Voice:  (630) 250-3045 x2164
  Fax:  (630) 250-3046
  
   Fichier: ATT14204.txt 
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, email: [EMAIL PROTECTED]
 
 

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]



 prueba.xml
 prueba.xsl

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]


RE: Need Working Sample

2001-07-06 Thread Steven Lane

The FopServlet reads a .fo file.  This is of no use to me.  I will
dyamically generate XML contianing only data.  This XML will be in a
StringBuffer.  I first need to apply an XSL sytle sheet to this
StringBuffer, generating a new XML stream (IN MEMORY).  This new (IN MEMORY)
XML stream then needs to be ran through FOP to generate a PDF stream which
will be sent back to the browser.  The embed sample also shows how to
process .FO files.  This is not what I want  The ONLY file that can be
on disk is the XSL file which contains the FO tags to apply to the XML data.

Applying XSL to your XML in memory should be fairly easy. The
transformation APIs in JAXP handle this. then just edit the servlet code to
handle something other than a file stream. I got this to work without much
problem a while ago. My code is appended below -- I think it worked with
0.17, haven't checked it in a while. It differs only slightly from the
original. The fo data comes in an HTTP parameter called fo, though you
can change the name. It loads this all into the String called fo. Then when
it sets up the driver, instead of passing it a FileInputSource, it passes
it a StringInputSource derived from the fo String.

I dimly recollect that the Driver interface changed a lot in 0.18 so some
of these methods may now be hidden, i.e. not called directly in the
servlet, but if you manually configure your driver, changing the type of
input source you hand it should not be hard.

-- sgl

/*-- $Id: FopServlet.java,v 1.2 2001/03/03 07:06:03 kellyc Exp $ --

 
   The Apache Software License, Version 1.1
 

Copyright (C) 1999 The Apache Software Foundation. All rights reserved.

 Redistribution and use in source and binary forms, with or without modifica-
 tion, are permitted provided that the following conditions are met:

 1. Redistributions of  source code must  retain the above copyright  notice,
this list of conditions and the following disclaimer.

 2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.

 3. The end-user documentation included with the redistribution, if any, must
include  the following  acknowledgment:  This product includes  software
developed  by the  Apache Software Foundation  (http://www.apache.org/).
Alternately, this  acknowledgment may  appear in the software itself,  if
and wherever such third-party acknowledgments normally appear.

 4. The names Fop and  Apache Software Foundation  must not be used to
endorse  or promote  products derived  from this  software without  prior
written permission. For written permission, please contact
[EMAIL PROTECTED]

 5. Products  derived from this software may not  be called Apache, nor may
Apache appear  in their name,  without prior written permission  of the
Apache Software Foundation.

 THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
 INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
 FITNESS  FOR A PARTICULAR  PURPOSE ARE  DISCLAIMED.  IN NO  EVENT SHALL  THE
 APACHE SOFTWARE  FOUNDATION  OR ITS CONTRIBUTORS  BE LIABLE FOR  ANY DIRECT,
 INDIRECT, INCIDENTAL, SPECIAL,  EXEMPLARY, OR CONSEQUENTIAL  DAMAGES (INCLU-
 DING, BUT NOT LIMITED TO, PROCUREMENT  OF SUBSTITUTE GOODS OR SERVICES; LOSS
 OF USE, DATA, OR  PROFITS; OR BUSINESS  INTERRUPTION)  HOWEVER CAUSED AND ON
 ANY  THEORY OF LIABILITY,  WHETHER  IN CONTRACT,  STRICT LIABILITY,  OR TORT
 (INCLUDING  NEGLIGENCE OR  OTHERWISE) ARISING IN  ANY WAY OUT OF THE  USE OF
 THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

 This software  consists of voluntary contributions made  by many individuals
 on  behalf of the Apache Software  Foundation and was  originally created by
 James Tauber [EMAIL PROTECTED]. For more  information on the Apache
 Software Foundation, please see http://www.apache.org/.

 */



// Java
import java.io.*;
import java.net.URL;
import java.util.Date;

import javax.servlet.*;
import javax.servlet.http.*;

// SAX
import org.xml.sax.XMLReader;
import org.xml.sax.InputSource;
import org.xml.sax.SAXException;
import org.xml.sax.SAXParseException;


// FOP
import org.apache.fop.messaging.MessageHandler;
import org.apache.fop.configuration.Configuration;
import org.apache.fop.apps.Driver;
import org.apache.fop.apps.Version;


/**
 * Example servlet to generate a PDF from a servlet.
 * Servlet param is:
 * ul
 *   lifo: the path to a formatting object file to render
 * /ul
 *
 * Example URL:
http://servername/servlet/FopServlet?fo=/home/fop/example/readme.fo
 *
 */

public class FopStream extends HttpServlet
{
public static final String FO_REQUEST_PARAM = fo;

/**