What’s the best way to convert XML into Java objects?
I don’t want a like for like representation, but would like to pull out certain data from the XML and populate a Java object. I had a look at XStream, but didn’t really like the whole “move down, move up” type of stuff. I would prefer a DOM like object when writing converters…
I know everybody loves automatic solutions like JAXB and such, but I’d recommend hand-coding
javax.xml.bind.Marshallerandjavax.xml.bind.Unmarshallerimplementations to get exactly what you want without filling up your perm gen space unnecessarily. Use JDOM to parse XML and map the values into Java objects using XPath. It’ll be some work to do it once, but you’ll have exactly what you need and nothing more.