Newbie to Android and developing an app where using XML parsing with the retrofit. I have completed all the process and done the task except one. I don't know how to create the POJO class for the "hours_of_operations" tag in below XML. A sample code would be a great help.
<dealers>
<dealer>
<name>Minnesota Tile & Stone</name>
<address>
...... </address>
<phone>12345678</phone>
<url>www.xyz.com</url>
<showroom_display_level>ooopppss</showroom_display_level>
<distance>11.76</distance>
<open>false</open>
<hours_of_operations>
<hours_of_operation>
<days>M,W,F</days>
<hours>10:00 - 5:00</hours>
</hours_of_operation>
<hours_of_operation>
<days>T,Th</days>
<hours>10:00 - 8:00</hours>
</hours_of_operation>
<hours_of_operation>
<days>Sat</days>
<hours>10:00 - 4:00</hours>
</hours_of_operation>
</hours_of_operations>
<google_static_map_url>
....... </google_static_map_url>
<google_map_url>
.......</google_map_url>
</dealer>
I have done with all attributes, just not sure about "hours_of_operations" and data inside that. Here is my Dealer class
@Root(name = "dealer")
public class Dealer {
@Element(name = "name")
private String name;
@Element(name = "address")
private Address adress;
@Element(name = "phone")
private long phone;
@Element(name = "url")
private String url;
@Element(name = "showroom_display_level", required = false)
private String showroom_display_level;
@Element(name = "distance")
private String distance;
@Element(name = "open", required = false)
private String open;
@Element(name = "hours_of_operations")
private HoursOfOperation hours_of_operations;
@Element(name = "google_static_map_url")
private String google_static_map_url;
@Element(name = "google_map_url")
private String google_map_url;
--getters--n -setters--
hoursofoperation class
@Root(name = "hours_of_operation", strict = false)
public class HoursOfOperation {
@Element(name = "days", required = false)
private String days;
@Element(name = "hours", required = false)
private String hours;
getters--setters
Here is my response class
@Root(name = "dealers", strict = false)
public class ApiResponse {
@ElementList(inline = true, required = false)
public List<Dealer> dealerList;
}
I am done with this XML, just not sure about the "hours_of_operations" Thanks in advance.