University of Cincinnati logo and link  
JAXB Validation
 
  UC ingot Two (plus one) types of validation can occur.
    • Unmarshal Time happens when the XML is unmarshalled into a content tree.
    • On Demand happens when the Validator.validate method is called to validate a content tree.
    • Fail Fast validation occurs when items are added to a tree.  When an element is added in violation, the client application is immediately warned.  Not all JAXB providers support this.
  • There are three ways to handle validation.
    • You can use the default event handler, which will attempt to continue if it gets a warning, but will stop the program when it reaches a fatal error.
    • You can write your own event handler.

    • You can use the ValidationEventCollector, which returns ValidationEvents in the form of a Collection.
 JAXB Mappings, Bindings