Assuming your JAXB model looks like this:
@XmlRootElement(name="foo")
public class Foo {
@XmlElement(name="element1")
String element1;
@XmlElement(name="element2")
String element2;
@XmlElement(name="bar")
Bar bar;
}
then simply removing the bar
field from Foo
will skip the <bar/>
element in the input document.
Alternatively, annotated the field with @XmlTransient
instead of @XmlElement
, and it will also be skipped.