[css2xslfo-support] Problem with embeding
Brought to you by:
wdonne
From: Renaud M. <ren...@de...> - 2007-08-02 10:30:12
|
Hello I'm trying to integrate css2xslfo in our product and to do so I absolutelly need to have a ContentHandler to receive SAX events generated by our system. So I tried using Example5 from the documentation but it doesn't seem to do anything usefull. The following simple test (based on Example5) just output verbatim my generated events to the file out.fo What am I missing, does anything else need to be set up tu use the filter as a simple ContentHandler? Thank you for your help public class Example5 { public static void main(String[] args) throws Exception { be.re.css.CSSToXSLFOFilter filter=new be.re.css.CSSToXSLFOFilter(); javax.xml.transform.sax.TransformerHandler handler=((javax.xml.transform.sax.SAXTransformerFactory)javax.xml.transform.TransformerFactory.newInstance()).newTransformerHandler(); handler.setResult(new javax.xml.transform.stream.StreamResult(new java.io.File("out.fo"))); filter.setContentHandler(handler); generateReport(filter); } private static void generateReport(org.xml.sax.ContentHandler handler) throws SAXException { handler.startDocument(); handler.startElement("http://www.w3.org/1999/xhtml","html","html",null); handler.startElement("http://www.w3.org/1999/xhtml","head","head",null); handler.startElement("http://www.w3.org/1999/xhtml","title","title",null); handler.endElement("http://www.w3.org/1999/xhtml","title","title"); handler.endElement("http://www.w3.org/1999/xhtml","head","head"); handler.startElement("http://www.w3.org/1999/xhtml","body","body",null); handler.startElement("http://www.w3.org/1999/xhtml","p","p",null); handler.characters("test".toCharArray(),0,4); handler.endElement("http://www.w3.org/1999/xhtml","p","p"); handler.endElement("http://www.w3.org/1999/xhtml","body","body"); handler.endElement("http://www.w3.org/1999/xhtml","html","html"); handler.endDocument(); } } -- Renaud MICHEL defimedia S.A. |