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.Object
This class is used to resolve the URI that can be found in a SVG document.
-
-
Field Summary
Fields Modifier and Type Field Description protected SVGOMDocument
document
The reference document.protected DocumentLoader
documentLoader
The document loader.protected java.lang.String
documentURI
The 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.Element
getElement(java.lang.String uri, org.w3c.dom.Element ref)
Imports the Element referenced by the given URI on Elementref
.org.w3c.dom.Node
getNode(java.lang.String uri, org.w3c.dom.Element ref)
Imports the Node referenced by the given URI on Elementref
.protected org.w3c.dom.Node
getNodeByFragment(java.lang.String frag, org.w3c.dom.Element ref)
Returns the node referenced by the given fragment identifier.protected java.lang.String
getRefererBaseURI(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.IOException
Imports the Element referenced by the given URI on Elementref
.- Parameters:
uri
- The element URI.ref
- The Element in the DOM tree to evaluateuri
from.- Returns:
- The referenced element or null if element can't be found.
- Throws:
java.net.MalformedURLException
java.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.SecurityException
Imports the Node referenced by the given URI on Elementref
.- Parameters:
uri
- The element URI.ref
- The Element in the DOM tree to evaluateuri
from.- Returns:
- The referenced Node/Document or null if element can't be found.
- Throws:
java.net.MalformedURLException
java.io.IOException
java.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
-
-