In our example, section property in Student class contains a min Length (4) constraints.In case the populated object is not meeting this constraint: Exception in thread "main" bind. SAXParse Exception: cvc-min Length-valid: Value 'Com' with length = '3' is not facet-valid with respect to min Length '4' for type '#Anon Type_section Student'.] at xml.v2.runtime. University; public class Jaxb Schema Validation Exception in thread "main" bind. SAXParse Exception: cvc-min Length-valid: Value 'Com' with length = '3' is not facet-valid with respect to min Length '4' for type '#Anon Type_section Student'.] at xml.v2.runtime.
This post shown how JAXB2 Schema validation can be used in your project, validating the generated XML against specific XML Schema Definition [XSD].
So here we go…JAXB stands for Java Architecture for XML Binding.
It provides a mechanism to marshal Java objects into XML and un-marshal XML into objects.
XMLSchema Validator.element Locally Valid Type(XMLSchema Validator.java:3103) at org.apache.xerces.xs. After all, we are here to learn together, aren’t we?
XMLSchema Validator.process Element Content(XMLSchema Validator.java:3013) at org.apache.xerces.xs.