8
I am trying to do the opposite of: JAXB - Ignore element
That is I'm trying to parse XML with JAXB to a POJO and I want to JAXB to fail if it does NOT find a matching Java property for a given element. I know I could probably do schema validation but I would rather not do that.
Example:
@XmlRootElement(name="Dog")
public class Dog {
private String name;
public String getName() {return name;}
public String setName(String name) {this.name = name};
}
This XML would fail:
<Dog>
<id>blah</id>
<name>Stuff</name>
</Dog>
Because there is no id Java property