Hello,
I have a problem in converting from xml to pdf.I am
attaching the code i have written.i have taken readme.xml
and readme.fo.xsl which is in fop-18 version. I am
implementing it as a servlet.servlet will execute and it
will open acrobat reader but it won't display anything on
the browser.In the server it will give
input XSL; lin1;column 1
XSL Error:could not parse Input XML document
XSL Error: SAX Exception
servlet Exception
My code is as follows.Please help me in this regard.I am
not able to get the solution.I request everybody in this
mail list please help me.
public void doGet(HttpServletRequest request,
HttpServletResponse res)
throws ServletException
{
res.setContentType("application/pdf");
try
{
String version = org.apache.fop.apps.Version.getVersion() ;
String xslSource ="readme.fo.xsl";
String xmlSource ="readme.xml";
XSLTResultTarget xsltResult = null; //
XSLTProcessor xsltProcessor =
XSLTProcessorFactory.getProcessor(new
org.apache.xalan.xpath.xdom.XercesLiaison
()); //
PrintWriter out = new PrintWriter(res.getOutputStream());
out1=out;
org.w3c.dom.Document outDoc = new
org.apache.xerces.dom.DocumentImpl(); //
XSLTInputSource xmlInput = new XSLTInputSource(new
StringReader(xmlSource)); //
XSLTInputSource xslInput = new XSLTInputSource
(xslSource); //
xsltResult = new XSLTResultTarget(outDoc);
xsltProcessor.process (xmlInput, xslInput, xsltResult);
org.apache.fop.apps.Driver driver = new
org.apache.fop.apps.Driver();
driver.setRenderer("org.apache.fop.render.pdf.PDFRenderer",
version);
driver.addElementMapping
("org.apache.fop.fo.StandardElementMapping");
driver.addElementMapping
("org.apache.fop.svg.SVGElementMapping");
driver.setOutputStream(res.getOutputStream());
PrintWriter out2 = new PrintWriter(res.getOutputStream());
driver.buildFOTree(outDoc);
driver.format();
driver.render();
}
with regards
S.M.Guru
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]