Reputation: 243
How can I parse something like this:
<?xml version="1.0">
<response>1</response>
?
Upvotes: 2
Views: 294
Reputation: 149057
You could have:
@XmlRootElement
@XmlAccessorType(XmlAccessType.FIELD)
public class Response {
@XmlValue
private int value:
}
Alternatively you could do:
Integer response = unmarshaller.unmarshal(xml, Integer.class).getValue();
Upvotes: 1