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