!InputStream.class.isAssignableFrom(componentType) &&
!InputSource.class.isAssignableFrom(componentType) &&
!componentType.isInterface()
) {
// Not an Object[], String[], File[], InputStream[], InputSource[]
MessageFormatter mf = fErrorReporter.getMessageFormatter(XSMessageFormatter.SCHEMA_DOMAIN);
throw new XMLConfigurationException(
XMLConfigurationException.NOT_SUPPORTED,
mf.formatMessage(fErrorReporter.getLocale(), "jaxp12-schema-source-type.2",
new Object [] {componentType.getName()}));
}
// JAXP spec. allow []s of type String, File, InputStream,
// InputSource also, apart from [] of type Object.
Object[] objArr = (Object[]) fJAXPSource;
// make local vector for storing target namespaces of schemasources specified in object arrays.
ArrayList jaxpSchemaSourceNamespaces = new ArrayList();
for (int i = 0; i < objArr.length; i++) {
if (objArr[i] instanceof InputStream ||
objArr[i] instanceof InputSource) {
SchemaGrammar g = (SchemaGrammar)fJAXPCache.get(objArr[i]);
if (g != null) {
fGrammarBucket.putGrammar(g);
continue;
}
}
fXSDDescription.reset();
xis = xsdToXMLInputSource(objArr[i]);
sid = xis.getSystemId();
fXSDDescription.fContextType = XSDDescription.CONTEXT_PREPARSE;
if (sid != null) {
fXSDDescription.setBaseSystemId(xis.getBaseSystemId());
fXSDDescription.setLiteralSystemId(sid);
fXSDDescription.setExpandedSystemId(sid);
fXSDDescription.fLocationHints = new String[]{sid};
}
String targetNamespace = null ;
// load schema
SchemaGrammar grammar = fSchemaHandler.parseSchema(xis,fXSDDescription, locationPairs);
if (fIsCheckedFully) {
XSConstraints.fullSchemaChecking(fGrammarBucket, fSubGroupHandler, fCMBuilder, fErrorReporter);
}
if (grammar != null) {
targetNamespace = grammar.getTargetNamespace();
if (jaxpSchemaSourceNamespaces.contains(targetNamespace)) {
// when an array of objects is passed it is illegal to have two schemas that share same namespace.
MessageFormatter mf = fErrorReporter.getMessageFormatter(XSMessageFormatter.SCHEMA_DOMAIN);
throw new java.lang.IllegalArgumentException(mf.formatMessage(fErrorReporter.getLocale(),
"jaxp12-schema-source-ns", null));
}
else {
jaxpSchemaSourceNamespaces.add(targetNamespace) ;
}