This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
RENDER_SVG with FOP
- From: "tpass001" <tpass001 at hotmail dot com>
- To: <xsl-list at lists dot mulberrytech dot com>
- Date: Thu, 22 Aug 2002 14:43:34 -0500
- Subject: [xsl] RENDER_SVG with FOP
- References: <CNEHJIJMDHDIGIPHFEBLIECGCHAA.james.fuller@o-idev.com>
- Reply-to: xsl-list at lists dot mulberrytech dot com
I am trying to use FOP to convert XML to SVG. I have used it already to
convert XML to PDF, PCL, TXT, etc.
But when I try to use SVG in this code
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
try {
String xsl = new String(getServletContext().getRealPath("/") +
"webFop.xsl");
ByteArrayOutputStream out = new ByteArrayOutputStream();
res.setContentType("image/svg-xml");
Driver driver =new Driver();
driver.setOutputStream(out);
driver.setRenderer(Driver.RENDER_SVG);
TransformerFactory tFactory = TransformerFactory.newInstance();
Source xslSource = new StreamSource(new URL("file:" +
xsl).openStream());
javax.xml.transform.Transformer transformer =
tFactory.newTransformer(xslSource);
Source xmlSource = new StreamSource(new StringReader(xml));
transformer.transform(xmlSource, new
SAXResult(driver.getContentHandler()));
byte[] content = out.toByteArray();
res.setContentLength(content.length);
res.getOutputStream().write(content);
res.getOutputStream().flush();
} catch (Exception ex) {
throw new ServletException(ex);
}
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
It gives me a SVGDocument class not found exception. I have the SVGDocument
class in the servlet lib folder in the batik.jar file. Any ideas?
Thanks.
TP
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list