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

Elliotte Rusty Harold <[email protected]> Mon, 8 Mar 2004 09:22:52 -0500
Newsgroups gmane.text.xml.sax.devel,gmane.text.xml.devel
Message-ID <p06010207bc72317626a7@[192.168.254.4]>
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
   [email protected]
   Effective XML (Addison-Wesley, 2003)
   http://www.cafeconleche.org/books/effectivexml
   http://www.amazon.com/exec/obidos/ISBN%3D0321150406/ref%3Dnosim/cafeaulaitA


-------------------------------------------------------
This SF.Net email is sponsored by: IBM Linux Tutorials
Free Linux tutorial presented by Daniel Robbins, President and CEO of
GenToo technologies. Learn everything from fundamentals to system
administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click
_______________________________________________
List: sax-devel, [email protected]
See:  http://www.saxproject.org/
https://lists.sourceforge.net/lists/listinfo/sax-devel