This blog post nicely describes how to generate Java classes with JAXB to read XML files, given a schema:
Using JAXB to Generate Java Objects from XML Document
In case you don’t have a schema you can also infer one. This online tool can do it for you:
Now a beer! Did you like this post? It often takes me several hours of my free time to write one. If I was your neighbour would you offer me a beer for the hard work I did for you? The beauty is: beers can be teletransported with a painless donation using Paypal. A beer in a Swiss bar costs about USD $4.80. Or use this affiliate link if you order something on Banggood and I'll get a small kickback. Thank you!