Reputation: 3
I am Stuck while unmarshel XML into POJO class using JAXB . based on input XML I can not able to generate perfect POJO class because of that unable to unmarshel XML . so can any one suggest what POJO is required based on Input XML Input XML :
<Main>
<Response>
<DataStatus>Request OK. Found 1 records.</DataStatus>
<List numberOfRows='277' pageIndex='1' pageSize='30000' totalNumberOfEntries='277'>
<DataStatus>
<Id>Mar09</Id>
<Name>0251</Name>
<Status>W</Status>
<StartDate>2009-02-25</StartDate>
<EndDate>2009-05-20</EndDate>
<ImpDelivered>0</ImpDelivered>
<ClicksDelivered>0</ClicksDelivered>
<WhenModified>2009-03-12 14:29:48</WhenModified>
</DataStatus>
</List>
</Response>
</Main>
POJO:
public class DataStatus {
private String id;
private String name;
private String status;
private String startDate;
private String endDate;
private String impDelivered;
private String clicksDelivered;
private String whenModified;
//setter and & getters
}
thanks for help in advance
Upvotes: 0
Views: 225
Reputation: 304
You are saying
I can not able to generate perfect POJO class
Are you realy want to generate class or instace of class POJO? In case of unmarshaling XML to java instance using JAXB you have to use annotation for class as @MouseEvent noticed. Here you can find explanation. For field it is same in case name of class attribute is not named same as xml tag.
In case of generating class it is more difficult but possible.
Upvotes: 1