InputStream is = ResourceUtils.getResourceStream(loc, BusFactory.getDefaultBus());
if (is == null) {
return;
}
ByteArrayInputStream bis = IOUtils.loadIntoBAIS(is);
XMLSource source = new XMLSource(bis);
source.setBuffering(true);
String targetNs = source.getValue("/*/@targetNamespace");
Map<String, String> nsMap =
Collections.singletonMap("xs", XmlSchemaConstants.XSD_NAMESPACE_URI);
String[] elementNames = source.getValues("/*/xs:element/@name", nsMap);
externalQnamesMap.put(targetNs, Arrays.asList(elementNames));
String schemaValue = source.getNode("/xs:schema", nsMap, String.class);
externalSchemasCache.add(schemaValue);
} catch (Exception ex) {
LOG.warning("No schema resource " + loc + " can be loaded : " + ex.getMessage());
externalSchemasCache = null;
externalQnamesMap = null;