02: JAXB with StAX Tutorial step by step for unmarshalling

This tutorial extends JAXB Tutorial for XML processing in Java step by step – unmarshall & marshall

When to use JAXB with StAX?

When you want to process large XML files, reading the whole file into memory can cause “OutOfMemoryError” as discussed in Java String & Array limitations and OutOfMemoryError post.

This approach is also good to process the middle of an XML document.

How to read the “book” author & title one by one?

JAXB and StAX in action

Output:


Java Developer Interview Q&As

800+ Java Interview Q&As

Top