Reputation: 335
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.
Upvotes: 0
Views: 3996
Reputation: 31437
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.
Upvotes: 2