October 28, 2010 at 3:40 PM
Here is the answer.
- sax is an event based parser and raise an event, while
dom is not.
- sax is forward only where as dom can acess both was
forward as well as backwards.
- sax parses the file as it reads where as the dom loads
the file into memory to parse the file.
- Sax does not have memory constraints where as the dom
has momory constraints as xml file is loaded into the
momory to parse the file.
- sax is read only , dom is read and write both.
- if you have to parse and use the content only once ,
consider using sax if the xml file and content are used
extensively then consider using dom.