Return-Path: Delivered-To: apmail-xmlgraphics-fop-users-archive@www.apache.org Received: (qmail 79733 invoked from network); 17 Apr 2007 13:17:24 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 17 Apr 2007 13:17:24 -0000 Received: (qmail 16720 invoked by uid 500); 17 Apr 2007 13:17:28 -0000 Delivered-To: apmail-xmlgraphics-fop-users-archive@xmlgraphics.apache.org Received: (qmail 16702 invoked by uid 500); 17 Apr 2007 13:17:28 -0000 Mailing-List: contact fop-users-help@xmlgraphics.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: fop-users@xmlgraphics.apache.org Delivered-To: mailing list fop-users@xmlgraphics.apache.org Received: (qmail 16679 invoked by uid 99); 17 Apr 2007 13:17:28 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 17 Apr 2007 06:17:28 -0700 X-ASF-Spam-Status: No, hits=2.8 required=10.0 tests=HTML_MESSAGE,INFO_TLD X-Spam-Check-By: apache.org Received-SPF: pass (herse.apache.org: local policy) Received: from [216.252.121.65] (HELO web43135.mail.sp1.yahoo.com) (216.252.121.65) by apache.org (qpsmtpd/0.29) with SMTP; Tue, 17 Apr 2007 06:17:20 -0700 Received: (qmail 40848 invoked by uid 60001); 17 Apr 2007 13:16:58 -0000 DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com; h=X-YMail-OSG:Received:Date:From:Subject:To:MIME-Version:Content-Type:Content-Transfer-Encoding:Message-ID; b=nCeKOplcAa0k0K7Miss2rh0fIdVos+P+sbnDQi3oNWTB8BPiKlhMPuWa9L41EFaTrhXI4Y6eEPbBVvc0Gb7wEo2vw9h+TDu7MJbjnBmM+VCzNa08r4he2YIap7IyAHNmWu7KMltm4nC6/PrDsBqhUcwOHsAJqBX3jlzGp7ud2ZU=; X-YMail-OSG: S9PIG0kVM1lZ79M7i7C_CsVawOiTvRlu7OFvT7Un2jYmqRkBo2sWRwNNO.W7nwu4r4JB9Eeu5j8fSHqmTXKV9xoGKgSPumUz0pYflZnb0XYufA.y_iGQJ8WZPEhYGZqxTZ2F_VpBLsU- Received: from [81.171.233.73] by web43135.mail.sp1.yahoo.com via HTTP; Tue, 17 Apr 2007 14:16:58 BST Date: Tue, 17 Apr 2007 14:16:58 +0100 (BST) From: Ian Hendry Subject: second run causes error To: fop users MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="0-2050772012-1176815818=:40594" Content-Transfer-Encoding: 8bit Message-ID: <734808.40594.qm@web43135.mail.sp1.yahoo.com> X-Virus-Checked: Checked by ClamAV on apache.org --0-2050772012-1176815818=:40594 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit Hi, I have implemented FOP on an tomcat 5 servlet. The XML data is read from Oracle 10g to a java.lang.String and then mixed with XSLT from the file system to produce the PDF. Once I start the tomcat server and run the servlet all is good and the PDF is produced correctly. When I run the servlet again I get a "File does not begin with '%PDF-" error. This error repeats until I restart the tomcat server. The error in the tomcat log is [INFO] ERROR: The processing instruction target matching "[xX][mM][lL]" is not allowed. I've research this error and it points to white space before the line in the XML but this seems not to be the case. Any ideas where to look next?? Thanks in advance, Ian. ByteArrayOutputStream out = new ByteArrayOutputStream(); org.apache.fop.configuration.Configuration.put("baseDir", "C:\\Program Files\\Apache Software Foundation\\Tomcat 5.0\\webapps\\GPS"); response.setContentType("application/pdf"); response.setHeader("Accept-Ranges", "bytes"); logger.info("xslParam : " + xslParam); logger.info("xmlParam : " + xmlParam); Source xslSrc = new StreamSource(new File(xslParam)); // Construct driver Driver driver = new Driver(); driver.setLogger(logger); driver.setRenderer(Driver.RENDER_PDF); driver.setOutputStream(out); //Setup XSLT TransformerFactory factory = TransformerFactory.newInstance(); Transformer transformer = factory.newTransformer(xslSrc); //Setup input for XSLT transformation Source xmlSrc = new StreamSource(new StringReader(xmlParam)); //Resulting SAX events (the generated FO) must be piped through to FOP Result res = new SAXResult(driver.getContentHandler()); //Start XSLT transformation and FOP processing transformer.transform(xmlSrc, res); //Send content to Browser response.getOutputStream().write(out.toByteArray()); response.flushBuffer(); --0-2050772012-1176815818=:40594 Content-Type: text/html; charset=iso-8859-1 Content-Transfer-Encoding: 8bit Hi,

I have implemented FOP on an tomcat 5 servlet. The XML data is read from Oracle 10g to a java.lang.String and then mixed with XSLT from the file system to produce the PDF. Once I start the tomcat server and run the servlet all is good and the PDF is produced correctly. When I run the servlet again I get a "File does not begin with '%PDF-" error. This error repeats until I restart the tomcat server. The error in the tomcat log is

[INFO] ERROR: The processing instruction target matching "[xX][mM][lL]" is not allowed.

I've research this error and it points to white space before the

<?xml version="1.0" encoding="UTF-8">

line in the XML but this seems not to be the case.

Any ideas where to look next??

Thanks in advance, Ian.


            ByteArrayOutputStream out = new ByteArrayOutputStream();
           
            org.apache.fop.configuration.Configuration.put("baseDir",
                    "C:\\Program Files\\Apache Software Foundation\\Tomcat 5.0\\webapps\\GPS");
           
            response.setContentType("application/pdf");
            response.setHeader("Accept-Ranges", "bytes");
           
            logger.info("xslParam : " + xslParam);
            logger.info("xmlParam : " + xmlParam);           
           
            Source xslSrc = new StreamSource(new File(xslParam));
           
            //    Construct driver
            Driver driver = new Driver();
            driver.setLogger(logger);
     
            driver.setRenderer(Driver.RENDER_PDF);
            driver.setOutputStream(out);

            //Setup XSLT        
            TransformerFactory factory = TransformerFactory.newInstance();
            Transformer transformer = factory.newTransformer(xslSrc);
            //Setup input for XSLT transformation
            Source xmlSrc = new StreamSource(new StringReader(xmlParam));
       
            //Resulting SAX events (the generated FO) must be piped through to FOP
            Result res = new SAXResult(driver.getContentHandler());

            //Start XSLT transformation and FOP processing
            transformer.transform(xmlSrc, res);

            //Send content to Browser
            response.getOutputStream().write(out.toByteArray());
            response.flushBuffer();
--0-2050772012-1176815818=:40594--