users@jaxb.java.net

Re: Missing attribute error handling problem

From: Kohsuke Kawaguchi <Kohsuke.Kawaguchi_at_Sun.COM>
Date: Mon, 30 Jul 2007 12:38:37 -0700

Ofer Kalisky wrote:
> I have a type with a required attribute. However, when I unmarshall an XML
> that is missing this attribute no exception is thrown. Is that a known
> issue? XML Validators (eclipse's XMLBuddy for example) report a problem in
> the bad element, btw.

It's a known behavior, yes. In general JAXB does not report all the
validation errors unless the validation is specifically turned on.

To enforce validation, use Unmarshaller.setSchema()

-- 
Kohsuke Kawaguchi
Sun Microsystems                   kohsuke.kawaguchi_at_sun.com