I\'m trying to figure out the simplest way to map an xml file to to a plain old java object.
Note: That in my example the xml doesn\'t quite match up with my intend
EclipseLink JAXB (MOXy) allows you to do the path based mapping that you are looking for:
@XmlRootElement
class Animal
{
@XmlPath("standardName/Name/text()")
private String name;
@XmlPath("standardVersion/VersionIdentifier/text()");
private String versionIdentifier;
}
For more information see:
EclipseLink also allows the metadata to be specified using an external configuration file: