Chapter 18
Streaming API for XML
This chapter focuses on the Streaming API for XML (StAX), a streaming Java-based,event-driven, pull-parsing API for reading and writing XML documents. StAX enables you tocreate bidrectional XML parsers that are fast, relatively easy to program, and havea light memory footprint.
StAX is the latest API in the JAXP family, and provides analternative to SAX, DOM, TrAX, and DOM for developers looking to do high-performancestream filtering, processing, and modification, particularly with low memory and limited extensibility requirements.
To summarize, StAX provides a standard, bidirectionalpull parser interface for streaming XMLprocessing, offering a simpler programming model than SAX and more efficient memory managementthan DOM. StAX enables developers to parse and modify XML streams as events,and to extend XML information models to allow application-specific additions. More detailed comparisons ofStAX with several alternative APIs are provided below, inComparing StAX to Other JAXP APIs.