I have an XML
<SubTask id="3">
<state>enabled</state>
</SubTask
There is a JAXB class with two variable "id" and "state".Now when I unmarshall the above XML, I don't want to load the "id" element into the Java object. How can I do this programmatically? I don't want to change the Java class.
Assuming your JAXB class has
@XmlElement(name="state")
String state;
then you should use @XmlTransient
to skip deserializing of element.
@XmlTransient(name="state")
String state;
Other possible solution is, remove those field from the class.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.