求XStream解析有嵌套bean的方案?
由于需要,我现在要把像这样的xml解析成对象
- XML code
<result resultCode="0"> < addMsgRt > <msgID>123456789</msgID> <diskInfo> <cSize>1000010</cSize> <oSize>1000000</oSize> <sz>3000000</sz> </diskInfo> <upld> <uploadTaskID></uploadTaskID> <redirectionUrl></redirectionUrl> <newContentIDList length="2"> <newContent> <contentID>123456789</contentID> <contentName>aaa.mms</contentName> </newContent> <newContent> <contentID>456789551</contentID> <contentName>bbb.eml</contentName> </newContent> </newContentIDList> </upld> </addMsgRt></result>
目前没有result对象,addMsgRt为Bean,包含msgId属性,diskinfo对象,upid对象。upid下的newContentIDList 为newContent的对象数组。如果我要把这个xml解析成AddMsgRt对象,该如何解析?
[解决办法]