这是OperatorXml类代码
DataPackage dp = (DataPackage)xstream.fromXML(new InputStreamReader(new FileInputStream(ftemp),Charset.forName("GBK"))); ArrayList<Data> das = dp.getDatas();
DataPackage 是另一个类
package com.automic.commu.bo; import java.util.ArrayList; /** * @author hxb * */ public class DataPackage { public final static String DATAPACKAGE = "dataPackage"; public final static String DATA = "data"; public final static String XMLSAVEDIR = "C:\\xml\\"; private ArrayList<Data> datas; public ArrayList<Data> getDatas() { return datas; } public void setDatas(ArrayList<Data> datas) { this.datas = datas; } }
是什么吧
xstream.fromXML(new InputStreamReader(new FileInputStream(ftemp),Charset.forName("GBK")));
转换成
DataPackage 类型的