Streaming API for XML (StAX) Proposed Final Draft Posted


News: Streaming API for XML (StAX) Proposed Final Draft Posted

  1. JSR 173, the Streaming API for XML, now has a Proposed Final Draft. StAX specifies a pull-parsing API for XML. A developer can use a cursor based API (XMLStreamReader/XMLStreamWriter), or the iterator based API that sits on top of that (XMLEventReader, XMLEventWriter). This API is designed to be easy to use, event based, easy to extend, and allow easy pipelining.

    Some comments from Elliott Harold:

    "There is a reference implementation bundled with the spec and JavaDoc. I haven't had time to write code with it yet, or to test the performance; but overall from the spec and JavaDoc I'd say this is the cleanest, most XML conformant pull parser I've seen to date. It's definitely a substantial improvement on XMLPULL. I'm giving the spec a thorough going over right now. So far my comments are mostly minor editorial issues. A few more major points:

    - The API relies on integer type codes rather than the class system to type the different kinds of events. This means programs are littered with big switch statements to find out what kind of node they've got. Many methods apply to some nodes but not others. This is a very ugly, un-object oriented design. NekoPull is the example of the right way to solve this problem.
    - The entity resolver doesn't support public IDs.
    - Whether or not CDATA sections are reported depends on their location. They should never be reported differently than any other text."

    Go to the JSR home page at:

    View the Proposed Final Draft at:

    Threaded Messages (4)

  2. Comparison between SAX/DOM/Stax[ Go to top ]

    I just wanted to tell you that there's an interesting article
    that makes comparisons between the different XML processing models.
    If you want a quick introduction to Stax see this article of the Oracle
    Magazine September edition:

  3. Reference implementation?[ Go to top ]

    Where can I find the reference implementation?
  4. Reference implementation?[ Go to top ]

    Where can I find the reference implementation?

    Seems to be embedded in the zipped spec document itself.
    - Dhananjay
  5. RI Available from the JCP Website[ Go to top ]


    To download the RI simply go to the JCP website at:

    You can click through to the final draft and get the .zip file. Unpack this archive it contains the spec & jsr173.jar.

    jsr173.jar has the following contents:

    jsr173_07.pdf [The specification]
    jsr173_07_api.jar [The API classes and interfaces]
    jsr173_07_examples.jar [A set of simple examples]
    jsr173_07_javadoc.jar [The API javadoc]
    jsr173_07_ri.jar [The Reference implementation]
    jsr173_07_src.jar [The API src]

    Hopefully this is all you need to get going with the API.

    Soon Dev2Dev will open a page describing STAX in more detail and will also release a preview of BEAs implementation.

    Have fun,

    Chris (STAX Architect & Specification Lead)