org.apache.uima.util

## Class XMLInputSource

- java.lang.Object
- - org.apache.uima.util.XMLInputSource

-     public class XMLInputSource
      extends Object

  An input source used by the `XMLParser` to read XML documents for parsing.

  The application uses the `XMLInputSource(File)` constructor to create an `XMLInputSource` from a descriptor `File`. Alternatively, if the source of the XML is not a file, the `XMLInputSource(InputStream,File)` constructor may be used to read the XML from an input stream. The second argument to this constructor is the relative path base, to be used if the descriptor contains imports with relative paths. It is acceptable to set this to null if it is known that the descriptor does not contain any such imports.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `XMLInputSource(File aFile)` Creates an `XMLInputSource` from a descriptor file.
    `XMLInputSource(InputStream aInputStream, File aRelativePathBase)` Creates an XMLInputSource from an existing InputStream.
    `XMLInputSource(String aUrlOrFileName)` Creates an `XMLInputSource` from a descriptor file.
    `XMLInputSource(URL aURL)` Creates an `XMLInputSource` from a URL.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods Deprecated Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `close()` Closes the underlying `InputStream`.
    `InputStream` | `getInputStream()` Gets the InputStream from which to read an XML document.
    `File` | `getRelativePathBase()` Deprecated. Use `getURL()` instead.
    `URL` | `getURL()` Gets the base for resolving relative paths.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### XMLInputSource

          public XMLInputSource(File aFile)
                         throws IOException

      Creates an `XMLInputSource` from a descriptor file.
      Parameters:
        `aFile` - file to read from
      Throws:
        `IOException` - if an I/O error occurs

    - #### XMLInputSource

          public XMLInputSource(String aUrlOrFileName)
                         throws IOException

      Creates an `XMLInputSource` from a descriptor file.
      Parameters:
        `aUrlOrFileName` - a URL or a file name to read from
      Throws:
        `IOException` - if an I/O error occurs

    - #### XMLInputSource

          public XMLInputSource(InputStream aInputStream,
                                File aRelativePathBase)

      Creates an XMLInputSource from an existing InputStream.
      Parameters:
        `aInputStream` - input stream from which to read
        `aRelativePathBase` - base for resolving relative paths. This must be a directory.

    - #### XMLInputSource

          public XMLInputSource(URL aURL)
                         throws IOException

      Creates an `XMLInputSource` from a URL.
      Parameters:
        `aURL` - URL to read from
      Throws:
        `IOException` - if an I/O error occurs

  - ### Method Detail

    - #### getInputStream

          public InputStream getInputStream()

      Gets the InputStream from which to read an XML document.
      Returns:
        an InputStream from which an XML document may be read

    - #### getRelativePathBase

          @Deprecated
          public File getRelativePathBase()

      Deprecated. Use `getURL()` instead.
      Gets the base for resolving relative paths. This must be a directory.
      Returns:
        the base for resolving relative paths, `null` if none has been specified.

    - #### getURL

          public URL getURL()

      Gets the base for resolving relative paths. This must be a directory.
      Returns:
        the base for resolving relative paths, `null` if none has been specified.

    - #### close

          public void close()
                     throws IOException

      Closes the underlying `InputStream`.
      Throws:
        `IOException` - if an I/O error occurs.

Copyright © 2006–2017 The Apache Software Foundation. All rights reserved.