What is SAX?

MSXML 5.0 SDK

Microsoft XML Core Services (MSXML) 5.0 for Microsoft Office - SAX2 Developer's Guide

What is SAX?

The Simple API for XML (SAX) is a publicly developed standard for the events-based parsing of XML documents. SAX defines an abstract programmatic interface that models the XML information set (infoset) through a linear sequence of familiar method calls.

Although SAX and DOM may seem different, each is simply a different projection of the XML infoset onto programmatic types. Because SAX does not demand resources for an in-memory representation of the document, it is a good alternative to the Document Object Model (DOM). SAX facilitates the search of large documents to extract small pieces of information and allows you to abort processing after the information is located. SAX can be used to build DOM trees (or portions of DOM trees); conversely, developers can traverse DOM trees and emit SAX streams.

However, the performance benefits of SAX come at a price. For example, in the case of advanced queries, SAX can be burdensome because of the complexities involved in managing context during processing. In these cases, most developers use the DOM or some combination of SAX and DOM.

SAX support in MSXML 5.0 includes methods for completing transformations and validation, which result in better messaging support for end users. This improves server-side transformations of documents as small as 10-20 kilobytes (KB) and the processing of documents of 1 megabyte (MB) or more.

See Also

Why Should I Use SAX? | Frequently Asked Questions About SAX2 | Using XSLT with SAX

Other Resources Other Resources

Megginson Technologies