Re: [XSL-FO] calling the SAX handler directly
- Schonberger Andras wrote:
> Apologies if my question is naive. Can I call the methods of FOP's SAXYou can call the handler directly. In fact in many cases it is
> handler directly ?
better than building an XML string and feed it through a parser.
It is, however, more common to build a DOM using a simple XML
vocabulary (rather than XSLFO) and pass it to an XSL transformation
which generates the XSLFO. Feeding a XSL Transforamtion with
SAX events also happens, there are quite a few applications where
some events map smoothly to SAX events, like parsing data files or
feeding database tables into a processing stream. Generating SAX
events for XSLFO directly is more outlandish.
Generating SAX events can be tricky, because you have to guarantee
the proper sequence of events, including startDocument etc. It is
easy to generate some out of sequence events, which will in general
lead to strange effects downstream. Be prepared for some long debug
sessions. The easiest way to debug a SAX event generator is probably
to serialize the event stream as XML document.