post请求解析xml格式
作者:互联网
<dependency>
<groupId>xom</groupId>
<artifactId>xom</artifactId>
<version>1.2.5</version>
</dependency>
/**
* post请求解析xml格式转实体
* @XmlRootElement(name ="STUDENT") 实体类注解
* @param jsonString 接口地址
* @return
*/
public static String readContent(String jsonString)throws IOException {
//STUDENT为XML最大节点
JAXBContext context = JAXBContext.newInstance(STUDENT.class);
Unmarshaller unmarshaller = context.createUnmarshaller();
STUDENT student = (STUDENT)unmarshaller.unmarshal(new StringReader(jsonString));
return requestJsonStr;
}
标签:xml,jsonString,String,unmarshaller,xom,STUDENT,post,解析 来源: https://blog.csdn.net/userenoch/article/details/112040433