首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > 编程 >

xstream的一些文件整理

2012-12-22 
xstream的一些资料整理1:xstream的作用:?? ? ? 把pojo对象转换成xml,把xml转换为pojo对象。默认基于?2:xstr

xstream的一些资料整理

1:xstream的作用:

?

? ? ? 把pojo对象转换成xml,把xml转换为pojo对象。默认基于

?

2:xstream的常用方法介绍:

?? 初时化:

?? XStream stream=new XStream();

??? 转换声明(对象和xml转换的规则声明) :

??? 1,stream.alias("xml显示", 类.class);//显示对象

??? 2,xstream.aliasField("xml显示", 类.class, "字段名");//显示字段

??? 3,stream.omitField(类.class, "属性名");//省略该字段

? ? 4,stream.useAttributeFor("属性名",类.class); //把该属性当作节点的属性

??? 5,stream.addImplicitCollection(ownerType, fieldName) //去掉集合的字段显示

??? 转换为xml:

?????? stream.toXML("对象");

??? 转换为pojo对象:

??????? xstream.fromXML("输入流||xml字符串");

?

热点排行