android中添加javax包: http://8-bits.diandian.com/post/2010-12-27/40049294105
解析map: http://stackoverflow.com/questions/1537207/how-to-convert-xml-to-java-util-map-and-vice-versa
如果解析的xml是“<destinations><destination><destination></destination></destinations>”的格式,即根节点是list 或map等,则需要声明根节点是list类型,示例代码如下:
CustomXStream customXStream = new CustomXStream();
customXStream.alias("destination", Destination.class);
customXStream.alias("destinations", List.class);
List<Destination> destinationList = (List<Destination>) customXStream
.fromXML(xml);如果是对象中的list,就不用声明了,会自动映射为list. 也就是根节点的类名总是要声明的。
542

被折叠的 条评论
为什么被折叠?



