Package com.icl.saxon

Class ExtendedInputSource


  • public class ExtendedInputSource
    extends org.xml.sax.InputSource

    This class allows a SAXON application to encapsulate information about an input source in a single object, which may include a public identifier, a system identifier, a byte stream (possibly with a specified encoding), a character stream, or a file.

    Most of the functionality is inherited directly from the SAX InputSource class; the additional functionality offered by ExtendedInputSource is to allow the input source to be specified as a File object.

    Author:
    Michael H. Kay
    • Constructor Summary

      Constructors 
      Constructor Description
      ExtendedInputSource()
      Default constructor
      ExtendedInputSource​(java.io.File file)
      Create a new input source from a File.
      ExtendedInputSource​(java.io.InputStream stream)
      Create a new input source from a byte stream
      ExtendedInputSource​(java.io.Reader reader)
      Create a new input source from a character stream
      ExtendedInputSource​(java.lang.String systemId)
      Create a new input source from a System ID
      ExtendedInputSource​(org.xml.sax.InputSource in)
      Create an ExtendedInputSource from an existing InputSource
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      static java.lang.String createURL​(java.io.File file)
      Create a URL that refers to a given File
      int getEstimatedLength()
      Get the estimated length of the file (advisory only; -1 if not known)
      void setEstimatedLength​(int length)
      Set the estimated length of the file (advisory only)
      void setFile​(java.io.File file)
      Specify that input is to come from a given File.
      • Methods inherited from class org.xml.sax.InputSource

        getByteStream, getCharacterStream, getEncoding, getPublicId, getSystemId, isEmpty, setByteStream, setCharacterStream, setEncoding, setPublicId, setSystemId
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • ExtendedInputSource

        public ExtendedInputSource()
        Default constructor
      • ExtendedInputSource

        public ExtendedInputSource​(java.lang.String systemId)
        Create a new input source from a System ID
      • ExtendedInputSource

        public ExtendedInputSource​(java.io.Reader reader)
        Create a new input source from a character stream
      • ExtendedInputSource

        public ExtendedInputSource​(java.io.InputStream stream)
        Create a new input source from a byte stream
      • ExtendedInputSource

        public ExtendedInputSource​(java.io.File file)
        Create a new input source from a File. Note that the directory in which the file occurs will be used as the base for resolving any system identifiers encountered within the XML document

        Example of use:
        parser.parse(new ExtendedInputSource(new File("test.xml")))

        Parameters:
        file - A File object identifying the XML input file
      • ExtendedInputSource

        public ExtendedInputSource​(org.xml.sax.InputSource in)
        Create an ExtendedInputSource from an existing InputSource
    • Method Detail

      • setFile

        public void setFile​(java.io.File file)
        Specify that input is to come from a given File.
      • setEstimatedLength

        public void setEstimatedLength​(int length)
        Set the estimated length of the file (advisory only)
      • getEstimatedLength

        public int getEstimatedLength()
        Get the estimated length of the file (advisory only; -1 if not known)
      • createURL

        public static java.lang.String createURL​(java.io.File file)
        Create a URL that refers to a given File