JAXP StAX: Difference between revisions
Jump to navigation
Jump to search
Line 12: | Line 12: | ||
StAX parsers can be used for state-dependent processing, unlike SAX parses, which can only be used for state-independent processing. | StAX parsers can be used for state-dependent processing, unlike SAX parses, which can only be used for state-independent processing. | ||
StAX is a read/write API, XML documents can be read and written with StAX. | |||
StAX offers a simpler programming model than SAX and more efficient memory management than JAXP DOM. | StAX offers a simpler programming model than SAX and more efficient memory management than JAXP DOM. |
Revision as of 01:37, 11 November 2016
External
- Elliotte Rusty Harold introduction to StAX http://www.xml.com/pub/a/2003/09/17/stax.html
Internal
Overview
The StAX API provide streaming, event-driven, pull parsing for reading and writing XML documents, as an alternative to SAX push parsing and JAXP DOM full in-memory tree structure representation. StAX has an iterator-based API, where the programmer asks for the next element (pulls the event).
StAX parsers can be used for state-dependent processing, unlike SAX parses, which can only be used for state-independent processing.
StAX is a read/write API, XML documents can be read and written with StAX.
StAX offers a simpler programming model than SAX and more efficient memory management than JAXP DOM.
Difference between Pull Parsing and Push Parsing
StAX Example
Component Packages
- javax.xml.stream defines the XMLStreamReader and XMLStreamWriter interfaces.
- javax.xml.transform.stax provide StAX specific transformation APIs.