The Apache Software Foundation > Apache XMLBeans

Validation Sample


Author: Steve Traut

Available: 2005-07-08

Versions: xmlbeans-1.0.3, xmlbeans-v2

This sample illustrates how you can use the XMLBeans API to validate XML instances against schema. The API provides two validation features:

  • A validate method (available from XmlOjbect and types generated from schema) with which you can validate the bound instance and collect error messages that result.
  • An option through which you can specify that simple schema types should be validated by XMLBeans when your code sets their value. This feature will simply throw an exception if setting the value renders the instance invalid.