Class 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.
    • 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 Element ref.
      org.w3c.dom.Node getNode​(java.lang.String uri, org.w3c.dom.Element ref)
      Imports the Node referenced by the given URI on Element ref.
      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.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • 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 Element ref.
        Parameters:
        uri - The element URI.
        ref - The Element in the DOM tree to evaluate uri 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 Element ref.
        Parameters:
        uri - The element URI.
        ref - The Element in the DOM tree to evaluate uri 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 fragment
        ref - the context element from which to resolve the URI fragment