Result result=null;
try {
JAXBContext context = JAXBContext.newInstance(Result.class);
Unmarshaller unmarshaller = context.createUnmarshaller();
result = (Result)unmarshaller.unmarshal(new StringReader(xmlStr));
} catch (JAXBException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
@XmlAccessorType(XmlAccessType.FIELD) @XmlRootElement(name="xxxx") public class Result { @XmlElement(name = "PT_Id") private Integer ptId; @XmlElement(name = "Is_Success") private Boolean isSuccess; @XmlElement(name = "Message") private String message; @XmlElementWrapper(name = "Records") @XmlElements(value = { @XmlElement(name = "Record",type = Record.class) }) private List<Record> lsQiYe;
原文链接:https://www.f2er.com/xml/295428.html