//
// If we are on windows we may have spaces in the uri
// which need to be escaped.
//
baseURI = baseURI.replaceAll(" ", "%20");
XmlSchemaCollection schemaCol = new XmlSchemaCollection();
schemaCol.setBaseUri(baseURI);
NodeList nodes = document.getElementsByTagNameNS(
WSDLConstants.NU_SCHEMA_XSD, "schema");
for (int x = 0; x < nodes.getLength(); x++) {
Node schemaNode = nodes.item(x);
Element schemaEl = (Element) schemaNode;
String tns = schemaEl.getAttribute("targetNamespace");
try {
schemaCol.read(schemaEl, tns);
} catch (RuntimeException ex) {
LOG.log(Level.WARNING, "SCHEMA_READ_FAIL", tns);
//
// Couldn't find schema... check if it's relative to wsdl.
// XXX - Using setBaseUri() on the XmlSchemaCollection,
// only seems to work for the first imported xsd... so pass
// in the baseURI here.
//
try {
schemaCol.read(schemaEl, baseURI);
} catch (RuntimeException ex2) {
LOG.log(Level.WARNING, "SCHEMA_READ_FAIL", baseURI);
continue;
}
}