if (schema == null) {
SchemaFactory factory = SchemaFactory.newInstance(schemaLanguage);
if (schemaSource == null) {
if (schemaResource == null) {
throw new JBIException("You must specify a schema, schemaSource or schemaResource property");
}
if (schemaResource.getURL() == null) {
schemaSource = new StreamSource(schemaResource.getInputStream());
} else {
schemaSource = new StreamSource(schemaResource.getInputStream(), schemaResource.getURL().toExternalForm());
}
}
schema = factory.newSchema(schemaSource);
}
}
catch (IOException e) {
throw new JBIException("Failed to load schema: " + e, e);
}
catch (SAXException e) {
throw new JBIException("Failed to load schema: " + e, e);
}
}