You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-dev@xmlgraphics.apache.org by Amit <ak...@uhc.com> on 2001/09/24 14:12:32 UTC

FOP WARNING

I am trying to generate PDFs using FOP-0.20.1. The input files are xml
and xsl files
I am using JRun3.0 with java1.2.2

Here is the error I get

WARNING: Unknown formatting object ^root

Anybody any ideas?




---------------------------------------------------------------------
To unsubscribe, e-mail: fop-dev-unsubscribe@xml.apache.org
For additional commands, email: fop-dev-help@xml.apache.org


Re: FOP WARNING

Posted by Semprini Davide <da...@cineca.it>.
Hi,

If you have your xml File and xsl file
on your hard drive, you have to pass
the complete String pattern of your
In example:
I use tomcat 3.2.3 and my webapp
is in http://localhost:8080/createpdf
I have put my xml and xsl file in a subdir
like:
C:\jakarta-tomcat-3.2.3\webapps\createpdf\xsl

and I pass String   xmlFile = 
"http:\\localhost:8080\createpdf\xsl\filename.xml";

Try This.

Bye



Amit wrote:

> I am trying this piece of code and it can't find the xml and xsl files...
> Anybody see anything that I am doing wrong? 



>
>  
>
> public void makePDF(String xmlFile, String xslFile,
>                          HttpServletResponse response) throws 
> ServletException {
>  
>    java.io.Reader reader;
>    Writer writer = new StringWriter();
>
>         try {
>  
>             ByteArrayOutputStream out = new ByteArrayOutputStream();
>   XSLTransform.transform(xmlFile,
>                                        xslFile, writer);
>
>   reader = new StringReader(writer.toString());
>  
>
>       response.setContentType("application/pdf");
>
>       Driver driver = new Driver(new InputSource(reader), out);
>       driver.setRenderer(Driver.RENDER_PDF);
>           driver.run();
>             byte[] content = out.toByteArray();
>             response.setContentLength(content.length);
>             response.getOutputStream().write(content);
>             response.getOutputStream().flush();
>
>         } catch (Exception ex) {
>             throw new ServletException(ex);
>         }
>  
>
>     }
>  
>
> Any help is greatly appreciated
>  
>  
>  
>  
>
> Semprini Davide wrote:
>
>> Okay,
>>
>> The example that I give is only to explain
>> that you can perform the PDF in two distinc phase
>> 1) perform a trasformation
>> 2) use driver
>>
>> You can use the "tranform method"
>> with input like Dynamic xml (Dom Document) or urlXML
>> and getting out a fo (Dom Document) or Writer object
>> YOU HAVE A LOT OF TRANSFORM TO USE!!!!!!
>> YOU HAVE TO SEE THE APIDOC FOR THE
>> COMPLETE DOCUMENTATION!!!!
>>
>> For example in my project I use
>> xalan transform and with some
>> conversion I use the Fop driver
>> and my XML is dynamic.
>> WITH Transformer XALAN:
>> StringWriter SstringWriter = new StringWriter();
>> /* this is the fo file */
>>  StreamResult SstreamResult = new StreamResult(SstringWriter);
>>
>> transformer.transform(SstreamSourceXML, SstreamResult)
>>
>> /* convert the fo file in a right format for driver
>>  ByteArrayOutputStream outPDF = new ByteArrayOutputStream();
>>  SResult = SstringWriter.toString();
>>  ByteArrayInputStream str = new 
>> ByteArrayInputStream(SResult.getBytes());
>>  Driver driver = new Driver(new InputSource(str), outPDF);
>>  
>>
>> Is this performance????? I think yes!!
>>
>> Bye
>>  
>>
>> Amit wrote:
>>
>>> Looking at your code I am guessing that you wrote the fo file out to 
>>> the filesystem and then used the driver to convert it to PDF...how 
>>> is performance on that?
>>> Instead of writing the file out to the file system did you try 
>>> converting into some sorta stream and use the driver??
>>>
>>> thanks for your help
>>> Amit
>>>
>>> Semprini Davide wrote:
>>>
>>>> Hi,
>>>>
>>>> I have had the same problem!!!!!!!!
>>>> Nobody give me a response!
>>>>
>>>> This code in FOP Home page don't work (for me!) !!!!!
>>>>
>>>>Driver driver = new Driver();
>>>>  driver.setRenderer(Driver.RENDER_PDF);
>>>>  InputHandler inputHandler = new XSLTInputHandler(xmlFile, xslFile);
>>>>  XMLReader parser = inputHandler.getParser();
>>>>  driver.setOutputStream(new FileOutputStream(outFile));
>>>>  driver.render(parser, inputHandler.getInputSource());
>>>>
>>>>
>>>> I have solved the problem using 2 phase:
>>>>
>>>> 1) generate the transformation using XSLTrasform, Xalan1Transform 
>>>> etc... (you can choose)
>>>> code:
>>>>
>>>> XSLTransform traXSLT = new XSLTransform();
>>>> traXSLT.transform(urlXML, urlXSL, urlFoFile);
>>>>
>>>> You can choose 4 transform type (see the api documentation)
>>>>
>>>> 2) Apply the result at the driver
>>>>
>>>> FileInputStream file = new FileInputStream(urlFoFile);
>>>>
>>>>     response.setContentType("application/pdf");
>>>>
>>>>     Driver driver = new Driver(new InputSource(file), out);
>>>>     driver.setRenderer(Driver.RENDER_PDF);
>>>>     driver.run();
>>>>     byte[] content = out.toByteArray();
>>>>     response.setContentLength(content.length);
>>>>     response.getOutputStream().write(content);
>>>>     response.getOutputStream().flush();
>>>>
>>>> THIS CODE WORK FINE!!!
>>>>
>>>> Bye
>>>>  
>>>>  
>>>>
>>>> Amit wrote:
>>>>
>>>>>I am trying to generate PDFs using FOP-0.20.1. The input files are xml
>>>>>and xsl files
>>>>>I am using JRun3.0 with java1.2.2
>>>>>
>>>>>Here is the error I get
>>>>>
>>>>>WARNING: Unknown formatting object ^root
>>>>>
>>>>>Anybody any ideas?
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>---------------------------------------------------------------------
>>>>>To unsubscribe, e-mail: fop-dev-unsubscribe@xml.apache.org
>>>>> <ma...@xml.apache.org>For additional commands, email: fop-dev-help@xml.apache.org <ma...@xml.apache.org>
>>>>>
>>>>>
>>>>>


Re: FOP WARNING

Posted by Amit <ak...@uhc.com>.
I am trying this piece of code and it can't find the xml and xsl
files...
Anybody see anything that I am doing wrong?


public void makePDF(String xmlFile, String xslFile,
                         HttpServletResponse response) throws
ServletException {

   java.io.Reader reader;
   Writer writer = new StringWriter();

        try {

            ByteArrayOutputStream out = new ByteArrayOutputStream();
  XSLTransform.transform(xmlFile,
                                       xslFile, writer);

  reader = new StringReader(writer.toString());


      response.setContentType("application/pdf");

      Driver driver = new Driver(new InputSource(reader), out);
      driver.setRenderer(Driver.RENDER_PDF);
          driver.run();
            byte[] content = out.toByteArray();
            response.setContentLength(content.length);
            response.getOutputStream().write(content);
            response.getOutputStream().flush();

        } catch (Exception ex) {
            throw new ServletException(ex);
        }


    }


Any help is greatly appreciated





Semprini Davide wrote:

> Okay,
>
> The example that I give is only to explain
> that you can perform the PDF in two distinc phase
> 1) perform a trasformation
> 2) use driver
>
> You can use the "tranform method"
> with input like Dynamic xml (Dom Document) or urlXML
> and getting out a fo (Dom Document) or Writer object
> YOU HAVE A LOT OF TRANSFORM TO USE!!!!!!
> YOU HAVE TO SEE THE APIDOC FOR THE
> COMPLETE DOCUMENTATION!!!!
>
> For example in my project I use
> xalan transform and with some
> conversion I use the Fop driver
> and my XML is dynamic.
> WITH Transformer XALAN:
> StringWriter SstringWriter = new StringWriter();
> /* this is the fo file */
>  StreamResult SstreamResult = new StreamResult(SstringWriter);
>
> transformer.transform(SstreamSourceXML, SstreamResult)
>
> /* convert the fo file in a right format for driver
>  ByteArrayOutputStream outPDF = new ByteArrayOutputStream();
>  SResult = SstringWriter.toString();
>  ByteArrayInputStream str = new
> ByteArrayInputStream(SResult.getBytes());
>  Driver driver = new Driver(new InputSource(str), outPDF);
>
>
> Is this performance????? I think yes!!
>
> Bye
>
>
> Amit wrote:
>
>> Looking at your code I am guessing that you wrote the fo file out to
>> the filesystem and then used the driver to convert it to PDF...how
>> is performance on that?
>> Instead of writing the file out to the file system did you try
>> converting into some sorta stream and use the driver??
>>
>> thanks for your help
>> Amit
>>
>> Semprini Davide wrote:
>>
>> > Hi,
>> >
>> > I have had the same problem!!!!!!!!
>> > Nobody give me a response!
>> >
>> > This code in FOP Home page don't work (for me!) !!!!!
>> >
>> > Driver driver = new Driver();
>> >   driver.setRenderer(Driver.RENDER_PDF);
>> >   InputHandler inputHandler = new XSLTInputHandler(xmlFile, xslFile);
>> >   XMLReader parser = inputHandler.getParser();
>> >   driver.setOutputStream(new FileOutputStream(outFile));
>> >   driver.render(parser, inputHandler.getInputSource());
>> >
>> >
>> > I have solved the problem using 2 phase:
>> >
>> > 1) generate the transformation using XSLTrasform, Xalan1Transform
>> > etc... (you can choose)
>> > code:
>> >
>> > XSLTransform traXSLT = new XSLTransform();
>> > traXSLT.transform(urlXML, urlXSL, urlFoFile);
>> >
>> > You can choose 4 transform type (see the api documentation)
>> >
>> > 2) Apply the result at the driver
>> >
>> > FileInputStream file = new FileInputStream(urlFoFile);
>> >
>> >     response.setContentType("application/pdf");
>> >
>> >     Driver driver = new Driver(new InputSource(file), out);
>> >     driver.setRenderer(Driver.RENDER_PDF);
>> >     driver.run();
>> >     byte[] content = out.toByteArray();
>> >     response.setContentLength(content.length);
>> >     response.getOutputStream().write(content);
>> >     response.getOutputStream().flush();
>> >
>> > THIS CODE WORK FINE!!!
>> >
>> > Bye
>> >
>> >
>> >
>> > Amit wrote:
>> >
>> >>  I am trying to generate PDFs using FOP-0.20.1. The input files
>> >>  are xml
>> >>  and xsl files
>> >>  I am using JRun3.0 with java1.2.2
>> >>
>> >>  Here is the error I get
>> >>
>> >>  WARNING: Unknown formatting object ^root
>> >>
>> >>  Anybody any ideas?
>> >>
>> >>
>> >>
>> >>
>> >>  ---------------------------------------------------------------------
>> >>  To unsubscribe, e-mail: fop-dev-unsubscribe@xml.apache.org
>> >>  For additional commands, email: fop-dev-help@xml.apache.org
>> >>
>> >>
>> >>
>> >>

Re: FOP WARNING

Posted by Semprini Davide <da...@cineca.it>.
Okay,

The example that I give is only to explain
that you can perform the PDF in two distinc phase
1) perform a trasformation
2) use driver

You can use the "tranform method"
with input like Dynamic xml (Dom Document) or urlXML 
and getting out a fo (Dom Document) or Writer object
YOU HAVE A LOT OF TRANSFORM TO USE!!!!!!
YOU HAVE TO SEE THE APIDOC FOR THE
COMPLETE DOCUMENTATION!!!!

For example in my project I use
xalan transform and with some
conversion I use the Fop driver
and my XML is dynamic.
WITH Transformer XALAN:
StringWriter SstringWriter = new StringWriter();
/* this is the fo file */
 StreamResult SstreamResult = new StreamResult(SstringWriter);

transformer.transform(SstreamSourceXML, SstreamResult)

/* convert the fo file in a right format for driver
 ByteArrayOutputStream outPDF = new ByteArrayOutputStream();
 SResult = SstringWriter.toString();              
 ByteArrayInputStream str = new 
ByteArrayInputStream(SResult.getBytes());       
 Driver driver = new Driver(new InputSource(str), outPDF);


Is this performance????? I think yes!!

Bye
 

Amit wrote:

> Looking at your code I am guessing that you wrote the fo file out to 
> the filesystem and then used the driver to convert it to PDF...how is 
> performance on that?
> Instead of writing the file out to the file system did you try 
> converting into some sorta stream and use the driver??
>
> thanks for your help
> Amit
>
> Semprini Davide wrote:
>
>> Hi,
>>
>> I have had the same problem!!!!!!!!
>> Nobody give me a response!
>>
>> This code in FOP Home page don't work (for me!) !!!!!
>>
>>Driver driver = new Driver();
>>  driver.setRenderer(Driver.RENDER_PDF);
>>  InputHandler inputHandler = new XSLTInputHandler(xmlFile, xslFile);
>>  XMLReader parser = inputHandler.getParser();
>>  driver.setOutputStream(new FileOutputStream(outFile));
>>  driver.render(parser, inputHandler.getInputSource());
>>
>>
>> I have solved the problem using 2 phase:
>>
>> 1) generate the transformation using XSLTrasform, Xalan1Transform 
>> etc... (you can choose)
>> code:
>>
>> XSLTransform traXSLT = new XSLTransform();
>> traXSLT.transform(urlXML, urlXSL, urlFoFile);
>>
>> You can choose 4 transform type (see the api documentation)
>>
>> 2) Apply the result at the driver
>>
>> FileInputStream file = new FileInputStream(urlFoFile);
>>
>>     response.setContentType("application/pdf");
>>
>>     Driver driver = new Driver(new InputSource(file), out);
>>     driver.setRenderer(Driver.RENDER_PDF);
>>     driver.run();
>>     byte[] content = out.toByteArray();
>>     response.setContentLength(content.length);
>>     response.getOutputStream().write(content);
>>     response.getOutputStream().flush();
>>
>> THIS CODE WORK FINE!!!
>>
>> Bye
>>  
>>  
>>
>> Amit wrote:
>>
>>>I am trying to generate PDFs using FOP-0.20.1. The input files are xml
>>>and xsl files
>>>I am using JRun3.0 with java1.2.2
>>>
>>>Here is the error I get
>>>
>>>WARNING: Unknown formatting object ^root
>>>
>>>Anybody any ideas?
>>>
>>>
>>>
>>>
>>>---------------------------------------------------------------------
>>>To unsubscribe, e-mail: fop-dev-unsubscribe@xml.apache.org
>>> <ma...@xml.apache.org>For additional commands, email: fop-dev-help@xml.apache.org <ma...@xml.apache.org>
>>>
>>>
>>>


Re: FOP WARNING

Posted by Amit <ak...@uhc.com>.
Looking at your code I am guessing that you wrote the fo file out to the
filesystem and then used the driver to convert it to PDF...how is
performance on that?
Instead of writing the file out to the file system did you try
converting into some sorta stream and use the driver??

thanks for your help
Amit

Semprini Davide wrote:

> Hi,
>
> I have had the same problem!!!!!!!!
> Nobody give me a response!
>
> This code in FOP Home page don't work (for me!) !!!!!
>
> Driver driver = new Driver();
>   driver.setRenderer(Driver.RENDER_PDF);
>   InputHandler inputHandler = new XSLTInputHandler(xmlFile, xslFile);
>   XMLReader parser = inputHandler.getParser();
>   driver.setOutputStream(new FileOutputStream(outFile));
>   driver.render(parser, inputHandler.getInputSource());
>
>
> I have solved the problem using 2 phase:
>
> 1) generate the transformation using XSLTrasform, Xalan1Transform
> etc... (you can choose)
> code:
>
> XSLTransform traXSLT = new XSLTransform();
> traXSLT.transform(urlXML, urlXSL, urlFoFile);
>
> You can choose 4 transform type (see the api documentation)
>
> 2) Apply the result at the driver
>
> FileInputStream file = new FileInputStream(urlFoFile);
>
>     response.setContentType("application/pdf");
>
>     Driver driver = new Driver(new InputSource(file), out);
>     driver.setRenderer(Driver.RENDER_PDF);
>     driver.run();
>     byte[] content = out.toByteArray();
>     response.setContentLength(content.length);
>     response.getOutputStream().write(content);
>     response.getOutputStream().flush();
>
> THIS CODE WORK FINE!!!
>
> Bye
>
>
>
> Amit wrote:
>
>> I am trying to generate PDFs using FOP-0.20.1. The input files are
>> xml
>> and xsl files
>> I am using JRun3.0 with java1.2.2
>>
>> Here is the error I get
>>
>> WARNING: Unknown formatting object ^root
>>
>> Anybody any ideas?
>>
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: fop-dev-unsubscribe@xml.apache.org
>> For additional commands, email: fop-dev-help@xml.apache.org
>>
>>
>>
>>

Re: FOP WARNING

Posted by Semprini Davide <da...@cineca.it>.
Hi,

I want explain that the error:

WARNING: Unknown formatting object ^root

for me is locate in stylesheet
Instead the error that
I have encountered it was on my XML
I think that the parser didn't know my element root!
For this reason I haven't used the code in fop home
and I have perform first the transformation
and then the driver

Bye

D.Semprini




 

 




Semprini Davide wrote:

> Hi,
>
> I have had the same problem!!!!!!!!
> Nobody give me a response!
>
> This code in FOP Home page don't work (for me!) !!!!!
>
>Driver driver = new Driver();
>  driver.setRenderer(Driver.RENDER_PDF);
>  InputHandler inputHandler = new XSLTInputHandler(xmlFile, xslFile);
>  XMLReader parser = inputHandler.getParser();
>  driver.setOutputStream(new FileOutputStream(outFile));
>  driver.render(parser, inputHandler.getInputSource());
>
>
> I have solved the problem using 2 phase:
>
> 1) generate the transformation using XSLTrasform, Xalan1Transform 
> etc... (you can choose)
> code:
>
> XSLTransform traXSLT = new XSLTransform();
> traXSLT.transform(urlXML, urlXSL, urlFoFile);
>
> You can choose 4 transform type (see the api documentation)
>
> 2) Apply the result at the driver
>
> FileInputStream file = new FileInputStream(urlFoFile);
>
>     response.setContentType("application/pdf");
>
>     Driver driver = new Driver(new InputSource(file), out);
>     driver.setRenderer(Driver.RENDER_PDF);
>     driver.run();
>     byte[] content = out.toByteArray();
>     response.setContentLength(content.length);
>     response.getOutputStream().write(content);
>     response.getOutputStream().flush();
>
> THIS CODE WORK FINE!!!
>
> Bye
>
>  
>
> Amit wrote:
>
>>I am trying to generate PDFs using FOP-0.20.1. The input files are xml
>>and xsl files
>>I am using JRun3.0 with java1.2.2
>>
>>Here is the error I get
>>
>>WARNING: Unknown formatting object ^root
>>
>>Anybody any ideas?
>>
>>
>>
>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: fop-dev-unsubscribe@xml.apache.org <ma...@xml.apache.org>
>>For additional commands, email: fop-dev-help@xml.apache.org <ma...@xml.apache.org>
>>
>>
>>
>


Re: FOP WARNING

Posted by Semprini Davide <da...@cineca.it>.
Hi,

I have had the same problem!!!!!!!!
Nobody give me a response!

This code in FOP Home page don't work (for me!) !!!!!

Driver driver = new Driver();
  driver.setRenderer(Driver.RENDER_PDF);
  InputHandler inputHandler = new XSLTInputHandler(xmlFile, xslFile);
  XMLReader parser = inputHandler.getParser();
  driver.setOutputStream(new FileOutputStream(outFile));
  driver.render(parser, inputHandler.getInputSource());


I have solved the problem using 2 phase:

1) generate the transformation using XSLTrasform, Xalan1Transform etc... 
(you can choose)
code:

XSLTransform traXSLT = new XSLTransform();
traXSLT.transform(urlXML, urlXSL, urlFoFile);

You can choose 4 transform type (see the api documentation)

2) Apply the result at the driver

FileInputStream file = new FileInputStream(urlFoFile);

    response.setContentType("application/pdf");

    Driver driver = new Driver(new InputSource(file), out);
    driver.setRenderer(Driver.RENDER_PDF);
    driver.run();
    byte[] content = out.toByteArray();
    response.setContentLength(content.length);
    response.getOutputStream().write(content);
    response.getOutputStream().flush();

THIS CODE WORK FINE!!!

Bye

 

Amit wrote:

>I am trying to generate PDFs using FOP-0.20.1. The input files are xml
>and xsl files
>I am using JRun3.0 with java1.2.2
>
>Here is the error I get
>
>WARNING: Unknown formatting object ^root
>
>Anybody any ideas?
>
>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: fop-dev-unsubscribe@xml.apache.org
>For additional commands, email: fop-dev-help@xml.apache.org
>
>
>


Re: FOP WARNING

Posted by Weiqi Gao <we...@networkusa.net>.
On Mon, 2001-09-24 at 07:12, Amit wrote:
> 
> I am trying to generate PDFs using FOP-0.20.1. The input files are
> xml and xsl files I am using JRun3.0 with java1.2.2
> 
> Here is the error I get
> 
> WARNING: Unknown formatting object ^root

The two times I've encountered this problem I either:

1. Misspelled the URI for the xmlns:fo attribute, or
2. Did not use the "fo:" prefix on the root element while the default
namespace is not the XSL-FO namespace.

-- 
Weiqi Gao
weiqigao@networkusa.net


---------------------------------------------------------------------
To unsubscribe, e-mail: fop-dev-unsubscribe@xml.apache.org
For additional commands, email: fop-dev-help@xml.apache.org