Getting Started with SAX2 (Windows Embedded CE 6.0)
1/6/2010
The Simple API for XML (SAX) is an interface that allows you to write applications to read data in an Extensible Markup Language (XML) document. SAX2 is the latest version of this application programming interface (API).
The SAX2 implementation, which provides both Microsoft® Visual Basic® and Microsoft Visual C++® interfaces, offers a simple, fast, low-overhead alternative to processing through the Document Object Model (DOM). When you use the DOM to manipulate an XML file, the DOM reads the file, breaks it up into individual objects, such as elements, attributes, and comments, and then creates a tree structure of the document in memory. The benefit of using the DOM is that you can reference and manipulate each object, called a node, individually. However, creating a tree structure for a document, especially a large document, requires significant amounts of memory.
Unlike the DOM, SAX2 is events-based, which means it generates events as it finds specific symbols in an XML document. One advantage of SAX2 is that it reads a section of an XML document, generates an event, and then moves on to the next section. Because SAX2 processes documents in this serial fashion, it uses less memory than the DOM and is better for processing large documents. SAX2 can create applications that abort processing when a particular piece of information is found.
The following topics help you get acquainted with the Microsoft implementation of SAX2:
- Choosing Between SAX and DOM
- SAX2 Implementation Examples
- Fundamentals of Events-Based Parsing
- Microsoft SAX2 COM Implementation