java - JAXB: Can we access and assign the inner node tags in the parent class using jaxb unmarshaller -
below xml have wanted convert object using jaxb unmarshaller:
<start> <name>sss</name> <address> <street1>xxx</street1> <street2>yyy</street2> <zip>121212</zip> </address> </start>
is there possibility access , set zip in start class?
below root class above xml, readability not completing setters , getters:
pacakge com.data //importing packages import javax.xml.bind.annotation.xmlelement; import javax.xml.bind.annotation.xmlrootelement; //root element class declaration @xmlrootelement(name="start") public class start { //elements in xml private string name; private address address; private int zip; @xmlelement(name="name") //setters , getters name tag @xmlelement(name="address") //setters , getters address tag @xmlelement(name="zip") //setters , getters zip tag public int getzip(){ return zip; } public void setzip(int zip){ this.zip = zip; } }
this can achieved using eclipselink , @xmlpath annotation
Comments
Post a Comment