my xml file is below:
<ExternalCases>
<ignoreTag>
<CashLess>
<caseType>CashLess</caseType>
<claimNo>9</claimNo>
<status>Open</status>
</CashLess>
</ignoreTag>
</ExternalCases>
i want to ignore <ignoreTag> and i want <CashLess> tag in my Unmarshaller process.
my class like below:
@XmlRootElement(name="ExternalCases")
public class ExternalCases {
List<CashLess> cashLess;
@XmlElement(name="CashLess", required=false)
public List<CashLess> getCashLess() {
return cashLess;
}
public void setCashLess(List<CashLess> cashLess) {
this.cashLess = cashLess;
}
}
Thanks.
ignoreTagYou could create a StAX filtered XMLStreamReader and have JAXB unmarshal that to ignore one or more XML elements.
Below is a link to a full example I gave in an answer to a similar question:
ignoreTag is a Grouping ElementIf instead ignoreTag is a grouping element for the collection then you could map it as:
@XmlElementWrapper(name="ignoreTag")
@XmlElement(name="CashLess", required=false)
public List<CashLess> getCashLess() {
return cashLess;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With