users@jaxb.java.net

Re: Unmarshaller validating against multiple schemas

From: Kohsuke Kawaguchi <Kohsuke.Kawaguchi_at_Sun.COM>
Date: Tue, 05 Jun 2007 16:25:19 -0700

Kenny MacLeod wrote:
> If I am trying to unmarhsall a document which contains elements from two
> different schemas, then there doesn't seem to be a way of getting JAXB
> to validating against both, given the setSchema() method.
>
> I have this situation because schema A has an <xs:any/> element type,
> and my document has elements from schema B under that wildcard element.
> Without being told about schema B, the validator complains about not
> recognising the schema B elements (I can't add processContents="skip" to
> schem A, sadly).
>
> Does validation work in these situations?

Yes. By using SchemaFactory.newSchema(), you should be able to pass in
two Sources representing two schemas.

-- 
Kohsuke Kawaguchi
Sun Microsystems                   kohsuke.kawaguchi_at_sun.com