You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by Apache Wiki <wi...@apache.org> on 2005/08/06 05:37:17 UTC
[Jakarta-commons Wiki] Update of "Digester/FAQ" by SimonKitching
Dear Wiki user,
You have subscribed to a wiki page or wiki category on "Jakarta-commons Wiki" for change notification.
The following page has been changed by SimonKitching:
http://wiki.apache.org/jakarta-commons/Digester/FAQ
The comment on the change is:
Fix incorrect info about all Rule classes being stateless.
------------------------------------------------------------------------------
A much cleaner solution is simply to create a new Digester instance for each XML
document parsed. If you are concerned about performance then you might want to
create a !RulesBase object, add rule instances to it, then reuse that object but
- create a separate Digester object each time. Unlike the Digester class, the Rule
- and !RulesBase classes are not supposed to be modified by the parsing, ie are
- "stateless" with respect to the sax parsing stage and so are pretty safe to reuse.
+ create a separate Digester object each time. Re-using rule instances can be
+ unsafe, however. The majority of Rule classes are stateless, but some are not.
+ Of the ones that do retain state, they are ''probably'' safe to reuse if the
+ parse was successful. When an error occurred during a digester parse, however,
+ these rules may well have internal state that will cause them to work incorrectly
+ on a future parse. Sorry, there is no list indicating which Rule classes are
+ stateless and which are not; you'll have to look at the source code for each
+ Rule class to figure that out.
You can also create a parser object and pass it to the digester constructor, to
save having to instantiate a new parser object when new Digester objects are
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org