java - Is it possible to have multiple xmlRootElements? -
i need have vo represent following xml
<rowset> <row> <order_num>5101330188</order_num> <line_num_seq>55</line_num_seq> <prod_num_req>9bx134-505</prod_num_req> </row> </rowset>
how can define 2 xmlrootelements representing rowset , row? vo this:
import javax.xml.bind.annotation.xmlattribute; import javax.xml.bind.annotation.xmlelement; import javax.xml.bind.annotation.xmlrootelement; @xmlrootelement(name = "rowset") public class testvo { string order_num; string line_num_seq; string prod_num_req; @xmlelement public string getline_num_seq() { return line_num_seq; } public void setline_num_seq(string line_num_seq) { line_num_seq = line_num_seq; } @xmlelement public string getorder_num() { return order_num; } public void setorder_num(string order_num) { order_num = order_num; } @xmlelement public string getprod_num_req() { return prod_num_req; } public void setprod_num_req(string prod_num_req) { prod_num_req = prod_num_req; } }
i cannot have 2 xmlrootelements need define <rowset>
& <row>
.
the solution change @xmlrootelement(name = "rowset")
@xmlrootelement(name = "row")
, invent object this
@xmlrootelement(name="rowset") public class rowset{ private list<testvo> vos; [...] }
because xml can not have more 1 root.
Comments
Post a Comment