I have worked previously with JAXB but I never faced an XML where nodes contained values. Like this one:
<node1>
<node2 id="abc"/>
</node1>
I did treat node1 as @XmlRootElement and then I used a list of Node2 objects annotated with @XmlElement. In Node2 object I have created a String variable 'id' as below
@XmlRootElement(name = "node1")
public class Node1{
@XmlElement(name="node2")
private List<Node2> node2list;
//get-set
}
public class Node2{
private String id;
//get-set
}
The problem is that I am not able to get the value of node2. It always gives null.