Difference between SAX parser and DOM parser - XML

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.
What is the difference between Schema and DTD? - XML
DTD supports two types of data – CDATA and PCDATA. Schema supports numeric, Boolean and String data types and suitable for applications.......
How do you parse/validate the XML document? - XML
Parsing the XML document is the only way to validate the XML file.......
What is XML template? - XML
A transformation rule describes a style sheet. Transmission rule is a combination of a pattern and a template.......
Post your comment