-
1. Re: Problem SchemaValidation with schema importing other schema
rkn Jul 1, 2010 12:46 PM (in response to rkn)In my opinion this is a bug. The class org.jboss.soa.esb.actions.validation.SchemaValidationAction loads or resolve only the first schema and not the related one.
See code:
/**
* Creates a Validator instance which will be used for schema validation.
*
* @param xsd The schema to validate against.
* @return Validator The Validator instance.
*
* @throws ConfigurationException Is an exception is thrown while trying to create the schema.
*/
private Schema createSchema(final String xsd) throws ConfigurationException
{
final SchemaFactory schemafactory = SchemaFactory.newInstance(schemaLanguage);
try
{
return schemafactory.newSchema(new StreamSource(ClassUtil.getResourceAsStream(xsd, getClass())));
}
catch (final SAXException e)
{
throw new ConfigurationException("Could not create a validator for schema '" + xsd + "'", e);
}
}If I load manually all the schemas, the problem is not there anymore
StreamSource streamSource=new StreamSource(ClassUtil.getResourceAsStream(xsd, getClass()));
StreamSource streamSource1=new StreamSource(ClassUtil.getResourceAsStream("/datatypes.xsd", getClass()));
StreamSource[] arrStreamSources={streamSource1,streamSource};return schemafactory.newSchema(arrStreamSources);
So, I would suggest JBossEsb team to have a look on this issue. In the meantime I'll try to implement my own createSchema class