In this tutorial we are going to see the Java Streaming API for XML (StAX).
The StAX is a streaming Java technology-based, event-driven, pull-parsing API for reading and writing XML documents. StAX enables you to create bidrectional XML parsers that are fast, relatively easy to program, and have a light memory footprint.
The Streaming API for XML (StAX) is the latest standard for processing XML in the Java language. As a stream-oriented approach, it often proves a better alternative to other methods, such as DOM and SAX, both in terms of performance and usability.
The StAX API is just like SAX API, but the main difference between StAX and SAX API are
- SAX is a “push” API. StAX is a “pull” API.
- SAX can only do XML reading. StAX can do both XML reading and writing.
The Pull Parsing :
In pull parsing model application can take the control over parsing XML document by pulling the event from the parser. The core StAX API is divided into two categories.
- Cursor API
- Event Iterator API
We can use any one of API for parsing XML documents.
We will see the details of PULL and PUSH API , Cursor and Event Iterator API’s, StAX with other API’s, Read, write XML using StAX API in upcoming tutorial.
0 comments:
Post a Comment