}
}
Import importDef = super.parseImport(element, definition, map);
addElementToList(element, importDef);*/
Import import1 = definition.createImport();
String s = DOMUtils.getAttribute(element, "namespace");
String s1 = DOMUtils.getAttribute(element, "location");
if (s != null)
import1.setNamespaceURI(s);
// ADD: check "location" attribute for empty
// string to prevent self-defenition assigning
if ((s1 != null) && (s1.length() > 0))
{
import1.setLocationURI(s1);
if (importDocuments)
try
{
String s2 = definition.getDocumentBaseURI();
Definition definition1 = null;
InputStream inputstream = null;
InputSource inputsource = null;
URL url = null;
if (loc != null)
{
inputsource = loc.getImportInputSource(s2, s1);
String s3 = loc.getLatestImportURI();
definition1 = (Definition) map.get(s3);
}
else
{
URL url1 = s2 == null ? null : StringUtils.getURL(null, s2);
url = StringUtils.getURL(url1, s1);
definition1 = (Definition) map.get(url.toString());
if (definition1 == null)
{
try
{
inputstream = url.openStream();
}
catch (IOException ex)
{
//import1.setLocationURI(null);
addElementToList(element, import1);
return import1;
}
if (inputstream != null)
inputsource = new InputSource(inputstream);
}
}
if (definition1 == null)
{
if (inputsource == null)
throw new WSDLException(
"OTHER_ERROR",
"Unable to locate imported document at '"
+ s1
+ "'"
+ (s2 != null ? ", relative to '" + s2 + "'." : "."));
Document document = null;
try
{
document = getDocument(inputsource, s1);
}
catch (WSDLException ex)
{
addElementToList(element, import1);
return import1;
}
if (inputstream != null)
inputstream.close();
Element element2 = document.getDocumentElement();
if (QNameUtils.matches(Constants.Q_ELEM_DEFINITIONS, element2))
{
//if (verbose)
// System.out.println(
// "Retrieving document at '"
// + s1
// + "'"
// + (s2 != null ? ", relative to '" + s2 + "'." : "."));
String s4 =
loc == null
? url == null
? s1
: url.toString() : loc.getLatestImportURI();
definition1 = readWSDL(s4, element2, map);
}
else
{
QName qname = QNameUtils.newQName(element2);
if (SchemaConstants.XSD_QNAME_LIST.contains(qname))
{
WSDLFactory wsdlfactory =
factoryImplName == null
? WSDLFactory.newInstance()
: WSDLFactory.newInstance(factoryImplName);
definition1 = wsdlfactory.newDefinition();
if (extReg != null)
definition1.setExtensionRegistry(extReg);
String s5 =
loc == null
? url == null
? s1
: url.toString() : loc.getLatestImportURI();
definition1.setDocumentBaseURI(s5);
/* Don't add types element since it doesn't exist. Adding it causes problems
* since it will add a types element for processing that does not exist.
Types types = definition1.createTypes();
UnknownExtensibilityElement unknownextensibilityelement =
new UnknownExtensibilityElement();
unknownextensibilityelement.setElement(element2);
types.addExtensibilityElement(
unknownextensibilityelement);
definition1.setTypes(types);
*/
}
}
}
if (definition1 != null)
import1.setDefinition(definition1);
}
catch (WSDLException wsdlexception)
{
wsdlexception.setLocation(XPathUtils.getXPathExprFromNode(element));
throw wsdlexception;
}
catch (Throwable throwable)
{
throw new WSDLException(
"OTHER_ERROR",
"Unable to resolve imported document at '" + s1 + "'.",
throwable);
}
}
for (Element element1 = DOMUtils.getFirstChildElement(element);
element1 != null;
element1 = DOMUtils.getNextSiblingElement(element1))
if (QNameUtils.matches(Constants.Q_ELEM_DOCUMENTATION, element1))
import1.setDocumentationElement(element1);
else
DOMUtils.throwWSDLException(element1);
return import1;