[Sax-devel] Re: A question on the SAX2 spec
Brought to you by:
dmegginson
From: David B. <da...@pa...> - 2002-04-10 19:47:16
|
Hi John, I think this is violates the spec, since SAX _does_ clearly specify that parsers may be reused ... and doesn't specify any need to reconfigure anything _except_ the InputSource (or equivalently, the systemId URI). (I could give more reasons, but I'll stop there...) However I can see how one approach to spec reading might assume that behavior is allowed, so I'll clarify this issue in the javadoc too. Note that there was a bug in the 2.0 spec, resolved in 2.0.1, which said effectively that (for all handlers) parser.setXXXHandler (parser.getXXXHandler ()) must have reported NPE for the default (null) configuration ... so there was no portable way to go back to the default configuration. For your purposes, that'd normally be the interesting "minimal space" config. The fix in 2.0.1 was to get rid of that needless asymmetry (requiring an NPE be reported) ... I suspect SAX 2.1 will go the next step and require it to do the natural thing, but meanwhile parsers implementing that strange 2.0 behavior remain conformant, as are ones that act much more usefully/sensibly. - Dave ----- Original Message ----- From: "John Wilson" <tu...@wi...> To: <dbr...@us...> Sent: Wednesday, April 10, 2002 11:21 AM Subject: A question on the SAX2 spec > David, > > In MinML2 I unset any handler settings at the end of the parse. The > MinML instance can be reused but the setXXXHandler calls must be repeated. I > do this out of a (possibly misguided) sense of tidiness and so that the GC > has the possibility of collecting the handlers (this can be important in > very tightly memory constrained systems like cellphones). > > It has been pointed out to me that this may not be in accordance with the > SAX2 spec. I have looked and cannot find anything which would prohibit this > behaviour. Does the spec prohibit this? > > Many thanks > > John Wilson > The Wilson Partnership > http://www.wilson.co.uk > |