users@jaxb.java.net

Unmarshaller.setSchema vs Unmarshaller.setEventHandler

From: Dmitri Colebatch <colebatchd_at_gmail.com>
Date: Fri, 10 Jun 2005 12:16:21 +1000

Hi again,

I'm in a situation where I want to be able to parse old versions of
schemas, including incompatible changes. When unmarshalling these
schemas I'd like to just ignore any elements or attributes that are
not in the current schema and fit the response into the current schema
structure as best as I can.

The javadoc for Unmarshaller.setSchema indicates that if i call
setSchema(null) there will be no validation. I tried this approach,
but still got failures (unexpected element). I'm now setting my own
ValidationEventHandler that simply returns true (ie ignore all
errors).

Two questions - firstly is the javadoc correct (btw this is using
jaxb-ri-20050407), and secondly is what I'm doing the best approach
for my scenario?

cheers
dim