There is limited pull support already in Xerces if you work at the XNI
level. (Actually, it's closer to "burst push".)

My solution when I needed a true event-by-event pull parser was to wrap the
SAX invocations in a coroutine-based "throttle" -- run the parser and app
in different threads and use some inter-thread handshaking to pause one
while the other was running and vice versa. I believe that code is checked
into the Xalan project, if you want to try adapting it to your own needs;
see the CoroutineManager and CoroutineParser classes.

This was a quick hack and can probably be improved (among other things, the
coroutine manager is fancier than it needs to be for this simple two-thread
management case); if you do clean it up, please submit the improvements
back to Xalan for consideration.


(The problem in layered systems is that EVERY layer wants to be the inner
loop to keep their code simple and efficient, which means they want pull on
input and push on output... and you can't satisfy them all without
something like coroutines, which have their own costs unless managed very
carefully.)

______________________________________
Joe Kesselman, IBM Next-Generation Web Technologies: XML, XSL and more.
"The world changed profoundly and unpredictably the day Tim Berners Lee
got bitten by a radioactive spider." -- Rafe Culpin, in r.m.filk


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to