RE: Using Xalan Transformer with FOP Driver problem

2002-06-21 Thread Shaikh, Mehmood
Try this.

// ---
// 1. Get a Source for XML document
// ---
 
 // a) from string
Source strSource = new StreamSource(new StringReader(xmlData));

// ---
// 2. Get stylesheet transformer
// ---
 // from file, see above examples for other types of XSL input
 //TransformerFactory
TransformerFactory transformerFactory = TransformerFactory.newInstance ();

 Templates template = transformerFactory.newTemplates( new StreamSource(
xslLayout ));
 // note - template object is multi-threaded and should be cached if you
// plan to use the same XSL repeatedly
Transformer transformer = template.newTransformer();
// ---
// 3. Create FOP driver and set rendering mode and output stream
// ---
Driver driver = new Driver();
driver.setRenderer(driver.RENDER_PDF);
ByteArrayOutputStream baos =  new ByteArrayOutputStream ();
driver.setOutputStream( baos);
// initialize logger - see sample code on FOP website
driver.setLogger(setLogger());

// ---
// 4. Create SAXResult based on FOP Driver content handler 
// which will accept SAX events and build FOP tree
// ---
Result saxResult = new SAXResult( driver.getContentHandler() );
// 5. Use the Transformer to transform an XML Source and 
// send the output to a Result object. Implicitely it will 
// create the FOP tree by firing SAX events.
transformer.transform( strSource, saxResult );
// 6. Your user is already viewing the PDF!
response.getOutputStream().flush();
response.getOutputStream().close();



-Original Message-
From: Anil R. Pinto [mailto:[EMAIL PROTECTED]
Sent: June 21, 2002 1:35 PM
To: '[EMAIL PROTECTED]'
Subject: Using Xalan Transformer with FOP Driver problem


Hi,

I have been using FOP to create PDF files for sometime now. Mostly as 
embedded code within my Struts Action classes, as mentioned in 
http://xml.apache.org/fop/embedding.html and it has been working just fine.

But this method requires the xml source to exist only as a java.io.File (if 
I am not mistaken), with no provision as an in memory object - like a Java 
String or Stream for example.

So when I looked at the Xalan site and this mailing list I saw the in 
memory implementation possible with the TransformerFactory and Transformer 
classes in Xalan. So, I tried this with a simple xml and xsl to test the 
concept first. But, I seem to be getting the error

building formatting object tree
building formatting object tree
javax.xml.transform.TransformerException
at 
org.apache.xalan.transformer.TransformerImpl.transformNode(TransformerIm  
pl.java:1212)
at 
org.apache.xalan.transformer.TransformerImpl.run(TransformerImpl.java:2894)
at java.lang.Thread.run(Thread.java:484)
-
java.lang.NullPointerException
at 
org.apache.fop.fo.FOTreeBuilder.startDocument(FOTreeBuilder.java:167)
at 
org.apache.xalan.transformer.QueuedStartDocument.flush(QueuedStartDocume  
nt.java:108)
at 
org.apache.xalan.transformer.ResultTreeHandler.flushPending(ResultTreeHa  
ndler.java:758)
at 
org.apache.xalan.transformer.ResultTreeHandler.startElement(ResultTreeHa  
ndler.java:245)
at 
org.apache.xalan.transformer.ResultTreeHandler.startElement(ResultTreeHa  
ndler.java:209)
at 
org.apache.xalan.templates.ElemLiteralResult.execute(ElemLiteralResult.j  
ava:704)
at 
org.apache.xalan.transformer.TransformerImpl.executeChildTemplates(Trans  
formerImpl.java:2154)
at 
org.apache.xalan.transformer.TransformerImpl.executeChildTemplates(Trans  
formerImpl.java:2097)
at 
org.apache.xalan.transformer.TransformerImpl.applyTemplateToNode(Transfo  
rmerImpl.java:2029)
at 
org.apache.xalan.transformer.TransformerImpl.transformNode(TransformerIm  
pl.java:1189)
at 
org.apache.xalan.transformer.TransformerImpl.run(TransformerImpl.java:2894)
at java.lang.Thread.run(Thread.java:484)
javax.xml.transform.TransformerException
at 
org.apache.xalan.transformer.TransformerImpl.transformNode(TransformerIm  
pl.java:1212)
at 
org.apache.xalan.transformer.TransformerImpl.run(TransformerImpl.java:2894)
at java.lang.Thread.run(Thread.java:484)
-
java.lang.NullPointerException
at 
org.apache.fop.fo.FOTreeBuilder.startDocument(FOTreeBuilder.java:167)
at 
org.apache.xalan.transformer.QueuedStartDocument.flush(QueuedStartDocume  
nt.java:108)
at 
org.apache.xalan.transformer.ResultTreeHandler.flushPending(ResultTreeHa  
ndler.java:758)
at 
org.apache.xalan.transformer.ResultTreeHandler.startElement(ResultTreeHa  
ndler.java:245)
at org.apache.xalan.transformer.ResultTreeHandler.startElement(R  
esultTreeHandler.java:209)
at 
org.apache.xalan.templates.ElemLiteralResult.execute(ElemLiteralResult.j  
ava:704)
at 
org.apache.xalan.transformer.TransformerImpl.executeChildTemplates(Trans  
formerImpl.java:2154)
at 
org.apache.xalan.transformer.TransformerImpl.executeChildTemplates(Trans  

What is log-1.0b4.jar

2002-04-26 Thread Shaikh, Mehmood
Hi,
Where can i download source and documentation for whats in log-1.0b4.jar? Is
it same as log4j??

Thanks

Mehmood


RE: What is log-1.0b4.jar

2002-04-26 Thread Shaikh, Mehmood
Thats ok, i found it.
Thanks

-Original Message-
From: Shaikh, Mehmood [mailto:[EMAIL PROTECTED]
Sent: April 26, 2002 1:07 PM
To: '[EMAIL PROTECTED]'
Subject: What is log-1.0b4.jar


Hi,
Where can i download source and documentation for whats in log-1.0b4.jar? Is
it same as log4j??

Thanks

Mehmood


FOP on Websphere OS390

2002-04-19 Thread Shaikh, Mehmood
Has anyone used FOP on Websphere 3.5 on OS390 USS?

Thanks

Mehmood


RE: FopServlet

2002-03-19 Thread Shaikh, Mehmood
Look in the log. Maybe your classpath is incorrect, maybe something is
missing. You never know.


-Original Message-
From: Samimi, Ashkan (Contractor) [mailto:[EMAIL PROTECTED]
Sent: March 19, 2002 6:22 AM
To: '[EMAIL PROTECTED]'
Subject: FopServlet


Hi,

Running this command on command prompt creates the PDF file perfectly:

FOP.bat  -xml glossay.xml -xsl glossay.xsl -pdf glossay.pdf

Running the same with FopServlet

http://localhost:7001/FopServlet?xml=glossay.xmlxsl=glossay.xsl

Does not do anything. No error messages, no initiation of acrobat reader.
Just a Blank browser screen.

I'm using FOP 0.20.3 and FopServlet provided in the Examples\embedding
directory.

What do I do wrong!!??

Can somebody help.

Many thanks in advance,

Ashkan