I've been playing around with cacheing SAX Events.
My motivation was to
implement something similar to the FileGenerator -
without the overhead
of reading/parsing a file every
Option 1 - cacheing the file contents as a String
and parsing the String at
each request. (Uses memory but removes the file
Option 2 - parse the file once and build a list of
'pointers to callback functions' using
the Method class, at each request, just run through
the list and call the invoke method.
(Uses less memory than option 1 and may be
In my experience, If virtual callback methods are
used, option 2 is slightly slower than option 1. If static
callback methods are used, option 2 is much quicker
than option 1.
If this is of value to any Cocoon developers, then
let me know.