SAX (Simple API for XML) Presented By: Tilak Poudel Nepathya College 6 th semester
SAX (Simple API for XML) Intrioduction : SAX ( Simple API for XML ) is an event-driven online algorithm for parsing XML documents, with an API developed by the XML-DEV mailing list. SAX provides a mechanism for reading data from an XML document that is an alternative to that provided by the Document Object Model (DOM). Sax generetes no parse tree
SAX (Simple API for XML) Where the DOM operates on the document as a whole, i.e. building the full AST of an XML document for convenience of the user. SAX parsers operate on each piece of the XML document sequentially, issuing parsing events while making single pass through the input stream. .
SAX processes documents state-independently, in contrast to DOM which is used for state-dependent processing of XML documents SAX is an event-driven interface. The programmer specifies an event that may happen and, if it does, SAX gets control and handles the situation.
When to use sax? Sax is used when: The xml document is processed in a linear fashion from top to bottom. The document is not deeply rooted. Very large xml document is processed whose dom tree would consume too much memory. The problem to be solved involves only part of the xml document.
Disadvantages of sax We have no random access to an xml document since it is processed in a forward only manner. Sax is read only parser.
For more detail please do visit Source::https://en.wikipedia.org/wiki/Simple_API_for_XML