try {
uri = new URI(wsdlURI);
} catch (URISyntaxException e) {
String msg = getErrorReporter().getFormattedMessage(
"WSDL506", new Object[] {null, wsdlURI});
throw new WSDLException(WSDLException.PARSER_ERROR, msg, e);
}
String fragment = uri.getFragment();
if (fragment == null) { //No fragment identifier so just use the root element.
return readWSDL(wsdlURI, domDoc.getDocumentElement());//Use document root if no WSDL20 root found.
} else {
XPointer xpointer;
try {
xpointer = new XPointer(fragment);
} catch(InvalidXPointerException e) {
String msg = getErrorReporter().getFormattedMessage(
"WSDL530", new Object[] {fragment, wsdlURI});
throw new WSDLException(WSDLException.PARSER_ERROR, msg, e);
}
Element root = domDoc.getDocumentElement();
DOMXMLElementEvaluator evaluator = new DOMXMLElementEvaluator(xpointer, root, getErrorReporter());
Element result = evaluator.evaluateElement();
if (result != null) { //Element from XPointer evaluation.
return readWSDL(wsdlURI, result);
} else {
String msg = getErrorReporter().getFormattedMessage(
"WSDL531", new Object[] {fragment, wsdlURI});
throw new WSDLException(WSDLException.PARSER_ERROR, msg);
}
}
}