I have to parse a xml into string objects in JAXB. But how to creates objects for this xml
Country.xml
<?xml version="1.0" encoding="UTF-8"?>
<Country>
<name>India</name>
<capital>New Delhi</capital>
<population>120crores</population>
.
.
.
.
.
<states>
<state>
<name>Maharastra</name>
<pincode>xyzzzz</pincode>
<capital>Mumbai</capital>
<\state>
<state>
.
.
.
</state>
</states>
<\Country>
And to parse this xml I have created class to map the objects which creates the objects and print it in the console. But Don't know what I am doing wrong.
@XmlElementWrapper(name="Country")
public void setCountry(String Countryv) {
Country= Countryv;
}
@XmlElement (name = "name")
public void setname(String namev) {
name= namev;
}
@XmlElement (name = "capital")
public void setcapital(String capitalv) {
capital= capitalv;
}
@XmlElement (name = "population")
public void setpopulation(String populationv) {
population= populationv;
}
@XmlElementWrapper(name="states")
public void setType(String statesv) {
states = statesv;
}
@XmlElementWrapper(name="state")
public void setType(String statev) {
state = statev;
}
@XmlElement (name = "name")
public void setpopulation(String namev) {
name= namev;
}
@XmlElement (name = "pincode")
public void setpopulation(String pincodev) {
pincode= pincodev;
}
@XmlElement (name = "capital")
public void setpopulation(String capitalv) {
capital= capitalv;
}
when I run the program I m getting the
com.sun.xml.internal.bind.v2.runtime.IllegalAnnotationsException: counts of IllegalAnnotationExceptions
How to add wrapper anotations to wrapping the elements under separate headers and headers inside other headers.