Paul Clapham wrote:There are a few options for unmarshalling XML into Java objects. The commonest one (I think) is JAXB, although there are others.
One of the others is the Apache Digester. Originally it was part of one of the Apache products, but these days it's used in so many projects that it's a product in its own right.
JAXB is more or less intended to convert XML to its exact equivalent in Java classes. This is useful, and one thing I've done with it in fact, is double-annotate model objects so that the same class serializes both as XML and as a database (JPA) model. Saves a lot of extra coding and parallel maintenance.
However, sometimes your intended Java objects aren't quite so exact a mapping, and this is where the Digester is popular.
The secret of how to be miserable is to constantly expect things are going to happen the way that they are "supposed" to happen.
You can have faith, which carries the understanding that you may be disappointed. Then there's being a willfully-blind idiot, which virtually guarantees it.