I am trying to parse the following XML. In this XML tags are coming dynamically. Tag names are not confirm. Value of the tag named "strCount" gives total number of tags (str0 to str10). Also the encounter tag can appear multiple times.
<pastPregenancies>
<encounter>
<strNo>1</strNo>
<strPPId>1</strPPId>
<str0>09/03/2004</str0>
<str1>4</str1>
<str2>2</str2>
<str3>6</str3>
<str4 />
<str5>m</str5>
<str6 />
<str7 />
<str8 />
<str9 />
<str10 />
<strCount>11</strCount>
</encounter>
</pastPregenancies>
I am using simple-xml for parsing. Following is the pojo I created for this, which doesn't work -
public class PastPregenancies {
@ElementList(entry="encounter", inline=true)
private List<?> encounter;
public List<?> getEncounter() {
return encounter;
}
public void setEncounter(List<?> encounter) {
this.encounter = encounter;
}
}
Please tell me how can I create pojo for parsing this type of xml.