SAX
There are two basic approaches to parsing an XML document:
The event-based approach. Under this approach, an XML parser reads an XML document one chunk at a time, processing each tag as it finds it in the document. Each time the parser encounters an XML construct (an element start tag, a CDATA block, or a PI), it generates an event that can be intercepted and processed by the application layer. A Simple API for XML (SAX) parser uses this event-based approach to parsing an XML document.
The tree-based approach (DOM). Here, an XML parser reads the entire document into memory at one time, and creates a hierarchical tree representation of it in memory. The parser also exposes a number of traversal methods, which developers can use to navigate ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access