StAX

Streaming API for XML ( StAX ) is an Application Programming Interface ( API) to process XML files from Java.

The reference implementation is available as free software under the terms of the Apache license.

Technology

Both options have advantages and disadvantages: the first one allows random access to the document, but must keep the document in memory and thus requires more memory. The second is a single pass through the source document and therefore requires very little memory and is also faster when parsing, but does not allow direct access to elements or changes of the tree.

StAX was designed as a middle ground between these two opposites. In the StAX metaphor of programmatic entry is a cursor that represents a point in the document. The application moves the cursor forward, so it brings the information needed by the parser if and only if it is needed. This differs from an event- based API, such as SAX, which actively sends the data to the application and therefore the application for administration of state information between events forces therein to hold the current position in the document.

StAX offers access to the XML data through a cursor on even an iterator method. The iterator returns the process data in the form of objects that are derived from the class XMLEvent. The created objects offer Java developers more options than String objects when cursor procedure, but they reduce the performance.

StAX is next to DOM, SAX, and XSLT one of the interfaces of the Java API for XML Processing.

Origins

StAX has cooperated its roots in a series of event-driven programming interfaces primarily " XMLPULL " whose authors (Stefan Haustein and Aleksandr Slominski ), among others, BEA, Oracle, Sun Microsystems, Breeze Factor and James Clark.

746756
de