String localname = qualifiedName.getLocalPart();
TypesElement types = descElement.getTypesElement();
if(types == null)
{
errorReporter.reportError(new ErrorLocatorImpl(), "Schema-1066", new Object[]{localname, namespace}, ErrorReporter.SEVERITY_ERROR);
return false;
}
Schema[] schemas = types.getSchemas();
int numSchemas = schemas.length;
boolean schemaNotFound = true;
// TODO: This linear search should be improved for performance.
for(int i = 0; i < numSchemas; i++)
{
URI schemaNs = schemas[i].getNamespace();
// If the schema namespace is null continue to the next one. This is not the
// schema we're looking for.
if(schemaNs == null)
continue;
if(schemaNs.toString().equals(namespace))
{
schemaNotFound = false;
break;
}
}
if(schemaNotFound)
{
errorReporter.reportError(new ErrorLocatorImpl(), "Schema-1066", new Object[]{localname, namespace}, ErrorReporter.SEVERITY_ERROR);
return false;
}
}
return true;
}