String baseURI = XMLBaseSupport.getCascadedXMLBase(ref);
if ((baseURI == null) &&
(uri.startsWith("#")))
return document.getElementById(uri.substring(1));
ParsedURL purl = new ParsedURL(baseURI, uri);
if (documentURI == null)
documentURI = document.getURL();
String frag = purl.getRef();
if ((frag != null) && (documentURI != null)) {
ParsedURL pDocURL = new ParsedURL(documentURI);
if (pDocURL.sameFile(purl))
return document.getElementById(frag);
}
// uri is not a reference into this document, so load the
// document it does reference after doing a security
// check with the UserAgent
ParsedURL pDocURL = null;
if (documentURI != null) {
pDocURL = new ParsedURL(documentURI);
}
UserAgent userAgent = documentLoader.getUserAgent();
userAgent.checkLoadExternalResource(purl, pDocURL);