Bertrand Delacretaz wrote:
Great work Peter!
It makes a lot of sense to use higher-level than SAX events, and thanks for explaining this so clearly.

If you allow me a suggestion regarding the structure of the code: maybe using some table-driven stuff instead of the many if statements in FoSimplePageMaster would be more readable?

Something like:

class EventHandler
{
EventHandler(String regionName,boolean discardSpace,boolean required)
...
}

/** table of event handlers that must be applied, in order */
EventHandler [] handlers = {
new EventHandler(FObjectNames.REGION_BODY,true,true),
new EventHandler(FObjectNames.REGION_BEFORE,true,false)
};

...then, in FoSimplePageMaster(...) loop over handlers and let them process the events.

I don't know if this applies in general but it might be clearer to read and less risky to modify.
Bertrand,

Sorry this one slipped through the cracks. Some such approach may be a good idea, but I would be loathe to call it EventHandler. The whole point about pull parsing is to move away from event handling. I would think of these more as methods with parameters like "optional", "single" or "multiple", "any".

Peter
--
Peter B. West [EMAIL PROTECTED] http://www.powerup.com.au/~pbwest/
"Lord, to whom shall we go?"


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



Reply via email to