Re: [css2xslfo-support] Problem with embeding
Brought to you by:
wdonne
From: <wer...@re...> - 2007-08-05 13:50:22
|
Hi Renaud, This is a bug. I have created bug entry 1767912 and patch 1767914 for this. From what I see I can't have tested example 5 in the manual at the time, for which I apologise. Best regards, Werner. Renaud MICHEL wrote: > 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(); > } > } > > -- Werner Donné -- Re Engelbeekstraat 8 B-3300 Tienen tel: (+32) 486 425803 e-mail: wer...@re... |