An enhancement request has been submitted to allow validation to occur based
on annotations alone (without a schema):
https://jaxb.dev.java.net/issues/show_bug.cgi?id=430
On 10/15/07, Shelley <randomshelley_at_gmail.com> wrote:
>
> There isn't a way to validate from annotated classes directly [1]. You
> can use schemagen [2] to generate a schema from your jaxb-annotated classes,
> and then pass that to Unmarshaller.setSchema().
>
> [1] https://jaxb.dev.java.net/servlets/ReadMsg?list=users&msgNo=7290
> [2] http://java.sun.com/webservices/docs/2.0/jaxb/schemagen.html
>
>
> On 10/15/07, Mitch Claborn <mitch_at_claborn.net> wrote:
> >
> > JAXB 2.1 ri20070917
> >
> > Looks like the way to unmarshal with validation in 2.1 is the
> > unmarshaller.setSchema() method. How do I get a schema from my
> > annontated
> > classes to pass to this method?
> >
> > E.G. I want the required=true in the following to be enforced:
> >
> > @XmlElement(required=true, name="page")
> >
> >
> >
> >
> > Mitch Claborn
> > mitch_at_claborn.net
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe_at_jaxb.dev.java.net
> > For additional commands, e-mail: users-help_at_jaxb.dev.java.net
> >
> >
>