Class UrlResolver

  • All Implemented Interfaces:
    ISchemaResolver

    public class UrlResolver
    extends java.lang.Object
    implements ISchemaResolver
    Basic resolver supporting relative URL paths.
    Author:
    Dennis M. Sosnoski
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private java.lang.String m_id
      Unique identifier for this schema document.
      private java.lang.String m_name
      Schema name.
      private java.net.URL m_url
      Schema document URL.
    • Constructor Summary

      Constructors 
      Constructor Description
      UrlResolver​(java.lang.String path, java.net.URL url)
      Constructor.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean equals​(java.lang.Object obj)  
      java.io.InputStream getContent()
      Get the content associated with this schema document.
      java.lang.String getId()
      Get unique identifier for this schema.
      java.lang.String getName()
      Get the schema name.
      java.net.URL getUrl()
      Get the document URL.
      int hashCode()  
      ISchemaResolver resolve​(java.lang.String loc, java.lang.String tns)
      Resolve a schema reference, which may be relative to this schema location.
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • m_url

        private final java.net.URL m_url
        Schema document URL.
      • m_name

        private final java.lang.String m_name
        Schema name.
      • m_id

        private final java.lang.String m_id
        Unique identifier for this schema document.
    • Constructor Detail

      • UrlResolver

        public UrlResolver​(java.lang.String path,
                           java.net.URL url)
        Constructor. This converts paths to a standard form by eliminating "./" and "../" relative path components.
        Parameters:
        path -
        url -
    • Method Detail

      • getContent

        public java.io.InputStream getContent()
                                       throws java.io.IOException
        Description copied from interface: ISchemaResolver
        Get the content associated with this schema document.
        Specified by:
        getContent in interface ISchemaResolver
        Returns:
        input stream
        Throws:
        java.io.IOException - on access error
      • getName

        public java.lang.String getName()
        Description copied from interface: ISchemaResolver
        Get the schema name.
        Specified by:
        getName in interface ISchemaResolver
        Returns:
        name
      • getId

        public java.lang.String getId()
        Description copied from interface: ISchemaResolver
        Get unique identifier for this schema.
        Specified by:
        getId in interface ISchemaResolver
        Returns:
        identifier
      • resolve

        public ISchemaResolver resolve​(java.lang.String loc,
                                       java.lang.String tns)
                                throws java.io.IOException
        Description copied from interface: ISchemaResolver
        Resolve a schema reference, which may be relative to this schema location. If a schema location is provided in the call that location should be used to identify the schema; the target namespace should only be used when the schema location is implicit.
        Specified by:
        resolve in interface ISchemaResolver
        Parameters:
        loc - target URL (null if none supplied)
        tns - target namespace URI (null if none supplied)
        Returns:
        resolver for target
        Throws:
        java.io.IOException - on resolve error
      • getUrl

        public java.net.URL getUrl()
        Get the document URL.
        Returns:
        url
      • equals

        public boolean equals​(java.lang.Object obj)
        Overrides:
        equals in class java.lang.Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object