I\'m having trouble trying to map nested elements into the same Java class.
XML
What I\'m trying to do here is to set id
attrib
If you use EclipseLink JAXB (MOXy) then you can leverage the @XmlPath extension for this (I'm the MOXy tech lead):
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlRootElement;
import org.eclipse.persistence.oxm.annotations.XmlPath;
@XmlRootElement
@XmlAccessorType(XmlAccessType.FIELD)
public class SlideText extends Slide {
@XmlPath("layout/text/text()")
private String text;
}
Using standard JAXB you could leverage an XmlAdapter: