XML parsers are libraries used for checking and validating XML document schema.
SAX Parser | DOM Parser |
---|
Instead of creating internal structure in the document, it takes the occurrences of components as events. | DOM parser creates a tree structure in memory from an input document and waits for client request. |
SAX Parser allows to extract the information in the document according to the users interest. | User can not extract the information of his interest. |
SAX parser is space efficient. | DOM Parser is space inefficient. |
Users have to create their own data structures. | DOM parser allows user to access any part of the document and modify the DOM tree. |
Assume that University has an XML document in which all the information of MCA students with their marks is there. It wants to assign final grades to the student and produce a list with Exam No and grades.
If University decides to give 'A' to those who earned class average and, 'B' to others.
If University decides to give A to those students who got 65% marks or more and B to others.