// Load the XML Schema
String uri = file.toURI().toString();
XSModel xsModel = loader.loadURI(uri);
// Convert top level complex type definitions to node types
XSNamedMap map = xsModel.getComponents(XSConstants.TYPE_DEFINITION);
for (int i = 0; i < map.getLength(); i++) {
XSTypeDefinition tDef = (XSTypeDefinition) map.item(i);
checkAndConvert(tDef, null, null);
}
// Convert local (anonymous) complex type defs found in top level element declarations
map = xsModel.getComponents(XSConstants.ELEMENT_DECLARATION);
for (int i = 0; i < map.getLength(); i++) {
XSElementDeclaration eDec = (XSElementDeclaration) map.item(i);
XSTypeDefinition tDef = eDec.getTypeDefinition();
checkAndConvert(tDef, eDec.getNamespace(), eDec.getName());
}
} catch (ClassNotFoundException e) {
throw new SchemaConversionException("XSLoader not found", e);