// System.err.println("URI: " + uri);
if (baseURI == null && uri.charAt(0) == '#') {
return getNodeByFragment(uri.substring(1), ref);
}
ParsedURL purl = new ParsedURL(baseURI, uri);
// System.err.println("PURL: " + purl);
if (documentURI == null)
documentURI = document.getURL();
String frag = purl.getRef();
if ((frag != null) && (documentURI != null)) {
ParsedURL pDocURL = new ParsedURL(documentURI);
// System.out.println("doc: " + pDocURL);
// System.out.println("Purl: " + purl);
if (pDocURL.sameFile(purl)) {
// System.out.println("match");
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);