Jaxb unmarshaller setvalidating
As I understand it, the call to set Validating is deprecated in JAXB 2.0 and I should use set Schema. If so, how can I have my Validating JAXBContext class create an appropriate validation.
I've been looking for solutions to this problem for far too long considering how easy it sounds so I've come for some help.
Rather than creating a general validating mechanism it might be better to have a general mechanism you inherit from for specific validating purposes i.e. Our Validation Event Collector throws an unchecked exception (JAXBParser Exception) which we then handle with Exception Mapper. Hi Andrew, Validating is indeed deprecated and you need to set the Schema object to validate against.
In this respect i am unsure how you can create a general validating mechanism unless you keep a map of known JAXB class to Schema instance.
Instances of those interfaces can be created from a object so that it is capable of managing the schema derived interfaces.
The client application must supply a context path which is a list of colon (':') separated java package names that contain schema derived classes.
Can anyone give me some advice on how I can validate marshalled XML to make sure it conforms to the XSD schema. If you are looking to verify the Java objects generate valid XML according to a schema, look at the JAXB-Verification project: https://java.net/ It is a JAXB RI plugin to xjc that will generate an Object Verifier implementation for the XML schema.
In this respect i am unsure how you can create a general validating mechanism unless you keep a map of known JAXB class to Schema instance. We have resolved this issue without needing to maintain a map of JAXB classes.