What is the Difference Between DOM and SAX Parser in Java ?

In Java, Document Object Model (DOM) parser loads the whole XML into memory and creates a tree based on DOM model. This helps it in quickly locating the nodes, and making a change in the structure of XML.

On the other hand, Simple API for XML (SAX) parser is an event based parser. It doesn't load the whole XML into memory. Due to this reason DOM is faster than SAX but require more memory and is not suitable to parse large XMLfiles.



You May Interest

What is the Difference Between an Iterator and ListIterator in Ja ...

Why ListIterator Has add Method But Iterator Does Not Have in Jav ...

What are the Disadvantages of Multithreading in Java ?

What is the Main Benefit of IOC Principle in Java ?

What is Difference Between Include Directive and Include Action o ...