2

How can I parse something like this:

<?xml version="1.0">
<response>1</response>

?

1

1 Answer 1

1

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();

Not the answer you're looking for? Browse other questions tagged or ask your own question.