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:


800+ Java Interview Q&As Menu

Learn by categories on the go...
Learn by categories such as FAQs – Core Java, Key Area – Low Latency, Core Java – Java 8, JEE – Microservices, Big Data – NoSQL, Architecture – Distributed, Big Data – Spark, etc. Some posts belong to multiple categories.
Top