The Sun Java Streaming XML Parser (SJSXP) FCS version 1.0 is now available in binary and source forms from Java.net. This parser is an implemenation of JSR 173, submitted to the JCP by BEA. We liked this parser and the StAX API so much that we've made it a key component of our Web services stack in Glassfish.
The Streaming API for XML (StAX) essentially turns the SAX processing model upside down. Instead of the parser controlling the application's flow, and the application reacting to parsing events, it is the application that control's the flow by "pulling" events from the parser. This parsing model has several advantages over SAX. First, it often makes the application logic easier to understand given that it is the application and not the parser that is in control of the process (stated differently, the application does not get "pushed around" :). Second, if implemented correctly, there are a number of new optimizations that are possible when the application does not need to process the entire infoset. In particular, it is possible to lazily wait until the application requests a certain infoset item before it is actually constructed (a good example of this is Java strings).
Post comment (1)