Hi João, If you're willing to stray a little away from writing pure JAXP code, you may be able to achieve what you want by setting the "http://apache.org/xml/features/internal/validation/schema/use-grammar-pool-only" feature to false on the SchemaFactory. This will tell the validator that it should try loading schema documents for target namespaces which are not already covered by the precompiled Schema object.
Thanks. Michael Glavassevich XML Parser Development IBM Toronto Lab E-mail: [EMAIL PROTECTED] E-mail: [EMAIL PROTECTED] "João Luís Pinto" <[EMAIL PROTECTED]> wrote on 09/28/2007 03:18:02 PM: > Hello, > > I have the following problem: I want to validate a XML snippet that > has the namespace attributes set at each element. > > Since it is a snippet, it does not provide schema location > information, although I know the main schema that is being used, and > where it is located. > > The problem is that that schema has <xsd:any> elements, which I > believe removes the possibility of having precompiled schema info as > in: > > StreamSource a = new StreamSource("a.xsd"); > StreamSource b = new StreamSource("b.xsd"); > > Schema schemas = sf.newSchema(new Source[]{a, b}); > > Validator validator = schemas.newValidator(); > > validator.setErrorHandler(myErrorHandler); > > DOMSource docSource = new DOMSource(Doc); > > validator.validate(docSource); > > because I don't know b.xsd beforehand and the compiled schema cannot > be updated. > > What I know beforehand is that the elements in <xsd:any> will follow > schema from a previously know set, and that the namespace->location > mapping is know. > > Does anyone have some suggestion of what I should do? > > Or will I have to build a map of namespaces->Sources and compile the > aggregated schema in each evaluation? > > Thanks, > > João > -- > O Insurgente - http://oinsurgente.org > > Small Brother - http://small-brother.blogspot.com > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]