Is there a SAX parser for JavaScript? From what it sounds like, you'd
use DOM API methods when you know something about the XML like an ID,
an attribute, or tag names whereas with SAX you can parse the XML
without knowing anything about its structure beforehand.

On Dec 31 2011, 9:05 pm, Poetro <poe...@gmail.com> wrote:
> 2011/12/31 dtang85 <dtan...@gmail.com>:
>
> > Whats the difference between SAX and DOM? Someone asked me that and my
> > initial thought was that DOM API methods is the main API for XML. Can
> > someone clarify? Thanks!
>
> SAX stands for Simple API for XML, and is a different method to parse
> the XML. The parser goes through the XML file and triggers event for
> everything it encounters. For example when it finds an opening tag, it
> triggers an event, when it finds an attribute, it triggers another
> one, when it reaches a text node then another, when it reaches the end
> of the tag then another. So it sequentially parses the XML file
> triggering event for everything it encounters within the XML during
> parsing. It is really fast, but it is sequential, so you cannot go
> back and forward withing the XML with it. If you want to do another
> run in the XML, you have to parse the whole XML another time, or you
> build a DOM like document during the SAX parsing.
>
> --
> Poetro

-- 
To view archived discussions from the original JSMentors Mailman list: 
http://www.mail-archive.com/jsmentors@jsmentors.com/

To search via a non-Google archive, visit here: 
http://www.mail-archive.com/jsmentors@googlegroups.com/

To unsubscribe from this group, send email to
jsmentors+unsubscr...@googlegroups.com

Reply via email to