XStream xStream = new XStream(new StaxDriver());
xStream.addPermission(AnyTypePermission.ANY); //不加后面转实体变异常
xStream.processAnnotations(resultDTO.getClass());
resultDTO = (ResultDTO) xStream.fromXML(result);
1、实体类设置别名
@XStreamAlias("MainExt")
2、忽略节点或属性
xStream.omitField(MainExtDTO.class, "PatientSettlement"); //忽略MainExtDTO实体中的PatientSettlement 节点或属性
或者 @XStreamOmitField
3、List节点的时候不显示根节点
@XStreamImplicit
标签:MainExtDTO,PatientSettlement,JAVA,xStream,简单,new,XStream,节点 From: https://www.cnblogs.com/ydj0208/p/17985985