Following is the difference between SAX Parser and DOM Parser asked during Java interview questions.
|
SAX
|
DOM
|
| Event based processing |
Tree based processing |
| Traversing only from top to bottom that too once |
Traversing can be in any direction and any number of times |
| Document content cannot be modified in SAX |
Document content can be modified in DOM |
| A SAX parser serves the client application always only with pieces of the document at any given time |
A DOM parser always serves the client application with the entire document no matter how much is actually needed by the client |
| More space efficient in case of a big input document |
is space inefficient when the document is huge |
See the following video on String Literal Pool asked during java Interview:-
Click for more Java interview questions
Regards,
Visit for more author’s blog on Java interview questions