Package org.apache.batik.bridge
Class URIResolver
- java.lang.Object
-
- org.apache.batik.bridge.URIResolver
-
- Direct Known Subclasses:
SVG12URIResolver
public class URIResolver extends java.lang.ObjectThis class is used to resolve the URI that can be found in a SVG document.- Version:
- $Id: URIResolver.java 1831635 2018-05-15 13:33:47Z ssteiner $
-
-
Field Summary
Fields Modifier and Type Field Description protected SVGOMDocumentdocumentThe reference document.protected DocumentLoaderdocumentLoaderThe document loader.protected java.lang.StringdocumentURIThe document URI.
-
Constructor Summary
Constructors Constructor Description URIResolver(org.w3c.dom.svg.SVGDocument doc, DocumentLoader dl)Creates a new URI resolver object.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description org.w3c.dom.ElementgetElement(java.lang.String uri, org.w3c.dom.Element ref)Imports the Element referenced by the given URI on Elementref.org.w3c.dom.NodegetNode(java.lang.String uri, org.w3c.dom.Element ref)Imports the Node referenced by the given URI on Elementref.protected org.w3c.dom.NodegetNodeByFragment(java.lang.String frag, org.w3c.dom.Element ref)Returns the node referenced by the given fragment identifier.protected java.lang.StringgetRefererBaseURI(org.w3c.dom.Element ref)Returns the base URI of the referer element.
-
-
-
Field Detail
-
document
protected SVGOMDocument document
The reference document.
-
documentURI
protected java.lang.String documentURI
The document URI.
-
documentLoader
protected DocumentLoader documentLoader
The document loader.
-
-
Constructor Detail
-
URIResolver
public URIResolver(org.w3c.dom.svg.SVGDocument doc, DocumentLoader dl)Creates a new URI resolver object.- Parameters:
doc- The reference document.dl- The document loader.
-
-
Method Detail
-
getElement
public org.w3c.dom.Element getElement(java.lang.String uri, org.w3c.dom.Element ref) throws java.net.MalformedURLException, java.io.IOExceptionImports the Element referenced by the given URI on Elementref.- Parameters:
uri- The element URI.ref- The Element in the DOM tree to evaluateurifrom.- Returns:
- The referenced element or null if element can't be found.
- Throws:
java.net.MalformedURLExceptionjava.io.IOException
-
getNode
public org.w3c.dom.Node getNode(java.lang.String uri, org.w3c.dom.Element ref) throws java.net.MalformedURLException, java.io.IOException, java.lang.SecurityExceptionImports the Node referenced by the given URI on Elementref.- Parameters:
uri- The element URI.ref- The Element in the DOM tree to evaluateurifrom.- Returns:
- The referenced Node/Document or null if element can't be found.
- Throws:
java.net.MalformedURLExceptionjava.io.IOExceptionjava.lang.SecurityException
-
getRefererBaseURI
protected java.lang.String getRefererBaseURI(org.w3c.dom.Element ref)
Returns the base URI of the referer element.
-
getNodeByFragment
protected org.w3c.dom.Node getNodeByFragment(java.lang.String frag, org.w3c.dom.Element ref)Returns the node referenced by the given fragment identifier. This is called when the whole URI just contains a fragment identifier and there is no XML Base URI in effect.- Parameters:
frag- the URI fragmentref- the context element from which to resolve the URI fragment
-
-