private void findImports(XmlSchema schema, Set<XmlSchema> processedImports, Set<XmlSchema> processedIncludes) {
processedImports.add(schema);
List<XmlSchemaExternal> externals = schema.getExternals();
for (XmlSchemaExternal external : externals) {
if (external instanceof XmlSchemaImport) {
XmlSchemaImport schemaImport = (XmlSchemaImport) external;
XmlSchema importedSchema = schemaImport.getSchema();
if (!"http://www.w3.org/XML/1998/namespace".equals(schemaImport.getNamespace()) &&
importedSchema != null && !processedImports.contains(importedSchema)) {
inlineIncludes(importedSchema, processedIncludes, processedImports);
findImports(importedSchema, processedImports, processedIncludes);
xmlSchemas.add(importedSchema);
}