}
for (XmlSchemaObject object : schema.getExternals()) {
if (object instanceof XmlSchemaImport) {
XmlSchemaImport schemaImport = (XmlSchemaImport) object;
XmlSchema schema1 = schemaImport.getSchema();
if (schema1 != null) {
compile(schema1, isPartofGroup);
} else if (schemaImport.getNamespace().equals(Constants.NS_URI_XML)) {
// AXIS2-3229: some Web services (e.g. MS Exchange) assume that
// http://www.w3.org/XML/1998/namespace is a known namespace and that
// no schemaLocation is required when importing it. Load a local copy of
// the schema in that case.
schema1 = new XmlSchemaCollection().read(new InputSource(
SchemaCompiler.class.getResource("namespace.xsd").toExternalForm()));
schemaImport.setSchema(schema1);
compile(schema1, isPartofGroup);
} else if (!schemaImport.getNamespace().equals(Constants.URI_2001_SCHEMA_XSD)) {
// Give the user a hint why the schema compilation fails...
log.warn("No schemaLocation for import of " + schemaImport.getNamespace() +
"; compilation may fail");
}
}
if (object instanceof XmlSchemaInclude) {
XmlSchema schema1 = ((XmlSchemaInclude) object).getSchema();