String fragment = uri.getFragment();
if (fragment == null) { //No fragment identifier so just use the root element.
XMLElement descEl = createXMLElement(root);
DescriptionElement descElem = parseDescription(url.toString(), descEl, null);
return descElem.toComponent();
} 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);
}
OMXMLElementEvaluator evaluator = new OMXMLElementEvaluator(xpointer, root, getErrorReporter());
OMElement result = evaluator.evaluateElement();
if (result != null) { //Element from XPointer evaluation.
XMLElement descEl = createXMLElement(result);
DescriptionElement descElem = parseDescription(url.toString(), descEl, null);
return descElem.toComponent();
} else {
String msg = getErrorReporter().getFormattedMessage(
"WSDL531", new Object[] {fragment, wsdlURI});
throw new WSDLException(WSDLException.PARSER_ERROR, msg);
}