Altova Mailing List Archives

Re: [xml-dev] SAX/Java Proposed Changes

From: Elliotte Rusty Harold <elharo@-------.---.--->
To: "Karl Waclawek" <karl@--------.--->
Date: 3/8/2004 2:16:00 PM
At 9:10 AM -0500 3/8/04, Karl Waclawek wrote:

>Yes, sounds more reasonable, as from the "cleanup" point of view such
>a method is the counterpiece to parse() rather than startDocument().
>Maybe we need both, one focussing on the actual end of the document,
>one indicating the end of the parsing process. And then one can
>divide responsibilities in a more intuitive way.

The problem with this approach is that it's unwieldy, not impossible 
but not pretty. In this pattern, the data structures must be 
initialized in one class before calling parse, filled in in the 
ContentHandler during the parse, and then torn down or flushed after 
the parse in the first class. Being able to rely on 
startDocument()/endDocument() in the ContentHandler allows all the 
initialization  and tear-down code to easily go in the same class as 
the code that fills the data structure. It's all neatly unified. This 
doesn't necessarily do anything that the other pattern can't do. It's 
just cleaner and easier to follow by keeping all the related code in 
one place.


   Elliotte Rusty Harold
   Effective XML (Addison-Wesley, 2003)


These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.