What is the difference between SAX parser and DOM parser?1. SAX:
- It is an event-driven online algorithm for parsing XML documents. - SAX stands for Simple API for XML Parsing. - It provides interfaces on handlers. - It does not create any internal structure. - SAX is developed especially for java programs. - It implements a model that is memory resident. - To access data from XML file, SAX follows top to bottom approach.
2. DOM:
- It is an official recommendation of the World Wide Web Consortium (W3C). - It provides interfaces on components of a tree which is a DOM document. - It creates a tree structure in memory from the input document and then waits for requests from the client. - It always serves the client application with the entire document no matter how much is actually needed by the client. - DOM is an open standard. - The XML file is arranged in a tree fashion. - DOM supports random access to the data of XML file.
|