>sample code demonstrating how to "feed" SAX events programmatically
A couple of short samples might be worthwhile, since there are a few
subtleties...
The simplest solution is to implement the SAX XMLReader interface in your
code, so you behave just like a parser. Wrap a SAXSource around that and
pass it into Xalan, accept Xalan's call-backs to register itself as a SAX
event handler, then when Xalan calls parse() begin issuing SAX event calls
to that handler. This has the advantage that it's absolutely standard SAX
programming, which everyone should understand pretty well.
There is also alternative approach, which we use when the source of SAX
events may not fully implement XMLReader, when we need that source (rather
than the transformation) running in the main thread, and/or when we don't
know what the source will be at the time we're setting up the
transformation. If DTMManager.getDTM is invoked with its source set to
null, we prepare Xalan's internal connections and start the transformation
thread running -- but we don't actually establish what the event source
will be. In that mode, we return an object that implements the SAX handler
API, and how it gets hooked up to an event source and when the events start
flowing is the caller's problem. This approach might actually be a trifle
cleaner for your application -- but it isn't well documented at this time.
I'd suggest starting with the former, pending a good example of the latter.