Question

I'm working on a project to generate code to validate data models. The validation constraints are based on type constraints defined in an XML schema. The data model itself is generated via JAXB.

The use case:

  • Generate data model classes from an XML schema using JAXB.
  • Store some data in the model programmatically.
  • Validate each object in the data model using the generated validation code.

Note that I'm not talking about validating an XML instance against the schema, nor am I talking about validating the schema itself -- I'm just using the XML schema as a convenient representation of a data structure and its constraints.

Has anyone ever heard of projects like this? Before diving into it, I want to make sure I'm not reinventing the wheel...

Was it helpful?

Solution

To follow up, I ended up going with XmlBeans for this project. It supports most of the validation features I mentioned. Also, I added a few things to locate specific validation errors within an object graph.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top