java - Xml List to Jaxb -
what way jaxb give convert type of xml conversion
<options> <option name="name">https://abc.com/</option> <option name="name2">https://abc.com/</option> </options> i created 2 object classes it. not fill object data , set null values tag should set url https://abc.com/.
options.java , option.java
options class contain setter
@xmlelement(name = "option") public void setoption(list<option> option) { this.option = option; } option.java class is:
@xmlrootelement(name = "option") public class option { string name; string option; public option() { super(); } public option(string name, string option) { super(); this.name = name; this.option = option; } public string getname() { return name; } @xmlattribute public void setname(string name) { this.name = name; } public string getoption() { return option; } public void setoption(string option) { this.option = option; }
you can use @xmlvalue annotation on option property of option class.
Comments
Post a Comment