A new XML document parsing technology is being developed as part of the Java
Community Process to supplement DOM and SAX. Called Streaming API for XML
or StAX, this technology is being developed under JSR-173
and is in its final draft stage. StAX parsing has significant advantages over
DOM and SAX which are discussed in the Sep/Oct. issue of Oracle Magazine in
the article - Parsing
XML Efficiently.
StAX gives parsing control to you through either a simple iterator-based API
and an underlying stream of events or a cursor style object API. Methods such
as next() and hasNext() allow you to pull the event by asking for next
one rather than handling it in a callback. This gives you precise control over
XML document processing. As distinct from other event-based approaches StAX
allows you to stop processing the document, skip ahead to sections of the document,
or get subsections of the document.
Oracle has produced a technology preview implementation of JSR-173 for you
do experiment with and provide us with feedback on your uses and/or issues with
the technology. The download includes the implementation as a jar file and a
couple of code samples illustrating the to APIs along with a readme. Please
note the prerequisites below as they are needed to build the samples. Feedback
and comments should be posted in the XML
Beta Forum.