On Tue, Jan 3, 2012 at 3:11 PM, Scott Sauyet <[email protected]> wrote:

> Austin Cheney wrote:
> > Scott Sauyet wrote:
> >> Austin Cheney wrote:
> >>> Why not just use SAX for initial parse and DOM methods there after?
> >
> >> What is the use-case for that?  I've used both SAX and DOM over the
> >> years, but never found a need to combine them.
>
> > The advantage is that SAX is faster for initial parse, so for
> > static documents parse using SAX.  When dynamic reading or writing
> > is required it is faster to use DOM opposed to parsing the entirety
> > of the document again with SAX.  The dynamic objective is not to
> > recreate or re-understand the entirety of the document structure
> > again, but instead to be highly targeted and do only the specific
> > operations needed.
>
> I do understand the differences in strengths of DOM and SAX.  I'm
> still trying to imagine a case in which I would want to do both for
> the same document.  Can you suggest such a case?
>


You may want to use SAX to stream-process a large XML document, but put
some specific fragments of it into DOM for ease of processing.

But there's absolutely no reason you'd ever want to use SAX and DOM on the
same xml -- unless you're just a masochist.

-- 
To view archived discussions from the original JSMentors Mailman list: 
http://www.mail-archive.com/[email protected]/

To search via a non-Google archive, visit here: 
http://www.mail-archive.com/[email protected]/

To unsubscribe from this group, send email to
[email protected]

Reply via email to