Difference Between SAX and DOM
SAX vs. DOM
Simple API for XML (also known as SAX) is a serial access parser API for XML (that is an API that obtains data, and analyses the text from that particular document in dynamically created web pages, or web pages with interactive content). It acts as one of the more popular alternatives to the Document Object Model (also known as DOM).
DOM is a convention that is completely independent of a specific language. It is a convention that is compatible with multiple platforms. It is used to represent and interact with objects in HTML, XML, and XHTML documents. Within the syntax of the language a DOM uses, many aspects of the DOM can be addressed and manipulated.
A SAX parser functions as what is known as a stream parser (which means it obtains and analyses text that is streaming from its location). It contains an event driven API (that is an API that is dependent on events that occur within a certain environment). The user has the control to define the number of callback methods (that is methods that trace back to the source of the requested data). These methods will be called when events occur during the act of parsing. There are four main events that could occur during parsing: XML Test nodes, XML Element nodes, XML Processing Instructions, and XML Comments. When these XML features are encountered, events are put in to play. Events also occur when these features have reached their end. As such, SAX is unidirectional (meaning moving in one direction), and data that was parsed previously cannot be re-read without starting the parsing operation back up.
1. SAX is a serial access parser API for dynamic web pages; DOM is a convention without a language or a dependency on language.
Search DifferenceBetween.net :
Email This Post : If you like this article or our site. Please spread the word. Share it with your friends/family.
Leave a Response