所需的jar包:xstream-1.4.3.jar xmlpull-1.1.3.1.jar
XStream xStream = new XStream(new DomDriver()); //定义XStream对象
xStream.alias("return", ResultParamUtil.class); //定义别名
对某类启动annotation功能时,要附加此代码
xstream.processAnnotations(BillId.class);
ClassAliasingMapper mapper = new ClassAliasingMapper(xstream.getMapper()); mapper.addClassAlias("tag", String.class); xstream.registerLocalConverter(ModulesConfig.class, "moduleNames", new CollectionConverter(mapper));