使用XStream来转换。
XStream xStream = new XStream();
xStream.autodetectAnnotations(true); //
xStream.alias("HardwareInfo", HardwareInfo.class);//将序列化中的类全量名称,用别名替换。
Object info2 = xStream.fromXML(xml);
时间: 2024-10-11 20:47:35
使用XStream来转换。
XStream xStream = new XStream();
xStream.autodetectAnnotations(true); //
xStream.alias("HardwareInfo", HardwareInfo.class);//将序列化中的类全量名称,用别名替换。
Object info2 = xStream.fromXML(xml);