What is the difference between SAX parser and DOM parser?
DOM spec defines an object-oriented hierarchy. The DOM parser creates an internal tree based on the hierarchy of the XML data. Tree stays in memory until released. The DOM parser is more memory intensive. DOM Parser’s advantage is that it is simple. Pairs nicely with XSLT. SAX spec defines an event based approach, calling handler functions whenever certain text nodes or processing instructions are found. These events include the start and end of the document, finding a text node, finding child elements, and hitting a malformed element. SAX development is more challenging. SAX can parse gigabytes worth of XML without hitting resource barriers. It’s also faster and more complex. Better for huge XML documents. Best suited for sequential-scan applications.