I'm having fun with a weird xml response I get - the xml:
<params>
<param>
<value><array><data>
<value><string>UstId_1</string></value>
<value><string>xxx</string></value>
</data></array></value>
</param>
<param>
<value><array><data>
<value><string>ErrorCode</string></value>
<value><string>200</string></value>
</data></array></value>
</param>
</params>
Basically, the most inner <value><string>
construct would normally be
<UstId_1>xxx</UstId_1>
and
<ErrorCode>200</ErrorCode>
respectively, so that the message of the xml boils down to
<params>
<UstId_1>xxx</UstId_1>
<ErrorCode>200</ErrorCode>
</params>
But this xml is different. It's returned by a tax authority, so there's no way to make them change that.
I currently have this pojo
@JacksonXmlRootElement(localName = "params")
public class Params {
@JacksonXmlProperty(localName = "param")
private List<Param> paramList = new ArrayList<>();
//getter setter ...
}
and Param:
public class Param {
@JacksonXmlProperty(localName = "value")
private Object value;
@JacksonXmlProperty(localName = "array")
private Object array;
@JacksonXmlProperty(localName = "data")
private Object data = new ArrayList<>();
//getter setter....
}
But that does only return the second entry from <value><string>
, e.g.
xxx
and
200
Also it's a very strange construct
Params{paramList=[Param{value={array={data={value={string=xxx}}}}, array=null, data=null}
...
How would I correctly set up a pojo for that xml to ideally be able to do
res.getUstId1();