我有以下输入从第三方进入我的应用
<?xml version="1.0"?>
<document>
<name>Foobar</name>
<descriprion>Foobar Foobar</descriprion>
<lead>Lorem</lead>
<bodytext>Foobar Foobar Lorem</bodytext>
<ImageFile1>pic123</ImageFile1>
<caption1><![CDATA[yadda yadda]]></caption1>
<photographer1><![CDATA[Mr. Foobar]]></photographer1>
<crop1>1.01 0 0 1.01 0 -80000 0</crop1>
<width1>283.86</width1>
<height1>164.51</height1>
...
<ImageFile38>000bemdt</ImageFile38>
<caption38><![CDATA[Ljubov Kavaljova]]></caption38>
<photographer38><![CDATA[]]></photographer38>
<crop38>1.24 0 0 1.24 -369326 -69264 0</crop38>
<width38>44.10</width38>
<height38>68.35</height38>
</document>
我正在将XML解组为对象X.请注意,图像文件元素没有被包装但是编号!如何将那些非包装和相关元素解组为对象列表,我将其设置到对象X的列表类型字段中?
public class Article()
{
private String name;
private String description;
private String lead;
private String bodytext;
private List<Picture> pictures;
}
public class Picture()
{
private String fileName;
private String caption;
private String photographer;
private String crop;
private String width;
private String height;
}