java - jaxb when xsi:nil=true if any child element exists it is still showing -
i have below xml output, how can hide kid element (enddate) when parent element has attribute xsi:nil=true kid element nillable=true?
//xml output
<?xml version="1.0" encoding="utf-8" standalone="yes"?> <snapshots xmlns:xsi="w3.org/2001/xmlschema-instance"; xmlns:ns3="ws.mycompany.com"; mask="pac"> <offers> <offer xsi:type="wsmarketingofferop" entityid="1234" xsi:nil="true"> <enddate xsi:nil="true"/> </offer> </offers> </snapshots> // snapshots class
@xmlaccessortype(xmlaccesstype.field) @xmltype(name = "", proporder = { "offerselement"}) @xmlrootelement(name = "snapshots") public class snapshots<t extends offer> { @xmlelement(name = "offers") private offerselement<t> offerselement; public offerselement<t> getofferselement() { homecoming offerselement; } public void setofferselement(offerselement<t> offerselement) { this.offerselement = offerselement; } } // offerselement class
@xmlaccessortype(xmlaccesstype.none) @xmlrootelement(name = "offer") public class offerselement<t> { @xmlelementref(name="offer") list<jaxbelement<t>> listoffers; public list<jaxbelement<t>> getlistoffers() { homecoming listoffers; } public void setlistmarketoffers(list<jaxbelement<t>> listoffers) { this.listoffers = listoffers; } } //wsoffer class offers marshelling, , endate nillable set true appear null.
@xmlrootelement(name = "offer") @xmltype(name = "", proporder = { "enddate" }) @xmlaccessortype(xmlaccesstype.field) public class wsoffer { @xmlelement(nillable = true) protected wsoffer.enddate enddate; public wsoffer.enddate getenddate() { homecoming enddate; } public void setenddate(wsoffer.enddate value) { this.enddate = value; } @xmlaccessortype(xmlaccesstype.field) @xmltype(name = "", proporder = { "value" }) public static class enddate { @xmlvalue protected date value; public date getvalue() { homecoming value; } public void setvalue(date value) { this.value = value; } } } java parsing jaxb marshalling jaxb2
No comments:
Post a Comment