URL oldURI = ((SVGOMDocument)svgDocument).getURLObject();
URL newURI = null;
try {
// if the anchor element is in an external resource
if (elt.getOwnerDocument() != svgDocument) {
SVGOMDocument doc =
(SVGOMDocument)elt.getOwnerDocument();
href = new URL(doc.getURLObject(), href).
toString();
}
newURI = new URL(oldURI, href);
} catch (MalformedURLException e) {
userAgent.displayError(e);
return;
}
href = newURI.toString();
svgUserAgent.openLink(href, true);
} else {
JSVGComponent.this.loadSVGDocument(href);
}
return;
}
// Avoid reloading if possible.
if (svgDocument != null) {
URL oldURI = ((SVGOMDocument)svgDocument).getURLObject();
URL newURI = null;
try {
// if the anchor element is in an external resource
if (elt.getOwnerDocument() != svgDocument) {
SVGOMDocument doc =
(SVGOMDocument)elt.getOwnerDocument();
href = new URL(doc.getURLObject(), href).toString();
}
newURI = new URL(oldURI, href);
} catch (MalformedURLException e) {
displayError(e);
return;