https://blog.csdn.net/u012881904/article/details/65448822
http://www.uziot.com/article/1396
public static void toXml(XmlExportOutPut xmlExportOutPut, FileOutputStream fileOutputStream) throws IOException{ String dec = getDeclaration(); byte[] bytesOfDec = dec.getBytes("UTF-8"); fileOutputStream.write(bytesOfDec); XStream stream =new XStream(); stream.alias("config",XmlExportOutPut.class); stream.alias("section", XmlPersonOutput.class); stream.aliasAttribute(XmlPersonOutput.class,"id","id"); stream.aliasAttribute(XmlPersonOutput.class,"name","name"); stream.aliasAttribute(XmlPersonOutput.class,"sex","sex"); stream.aliasAttribute(XmlPersonOutput.class,"tel","tel"); stream.aliasAttribute(XmlPersonOutput.class,"cardid","cardid"); stream.aliasAttribute(XmlPersonOutput.class,"cardtype","cardtype"); stream.aliasAttribute(XmlPersonOutput.class,"nationality","nationality"); stream.aliasAttribute(XmlPersonOutput.class,"age","age"); stream.aliasAttribute(XmlPersonOutput.class,"picpath","picpath"); stream.aliasAttribute(XmlPersonOutput.class,"ex","ex"); stream.addImplicitArray(XmlExportOutPut.class,"xmlPersonOutputs"); stream.toXML(xmlExportOutPut,fileOutputStream); }