Package org.apache.uima.util
Class XMLInputSource
java.lang.Object
org.apache.uima.util.XMLInputSource
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
ConstructorDescriptionXMLInputSource
(File aFile) Creates anXMLInputSource
from a descriptor file.XMLInputSource
(InputStream aInputStream) Creates an XMLInputSource from an existing InputStream.XMLInputSource
(InputStream aInputStream, File aRelativePathBase) Creates an XMLInputSource from an existing InputStream.XMLInputSource
(String aUrlOrFileName) Creates anXMLInputSource
from a descriptor file.XMLInputSource
(URL aURL) Creates anXMLInputSource
from a URL. -
Method Summary
-
Constructor Details
-
XMLInputSource
Creates anXMLInputSource
from a descriptor file.- Parameters:
aFile
- file to read from- Throws:
IOException
- if an I/O error occurs
-
XMLInputSource
Creates anXMLInputSource
from a descriptor file.- Parameters:
aUrlOrFileName
- a URL or a file name to read from- Throws:
IOException
- if an I/O error occurs
-
XMLInputSource
Creates an XMLInputSource from an existing InputStream.- Parameters:
aInputStream
- input stream from which to read
-
XMLInputSource
Creates an XMLInputSource from an existing InputStream.- Parameters:
aInputStream
- input stream from which to readaRelativePathBase
- (optional) base for resolving relative paths. This must be a directory.
-
XMLInputSource
Creates anXMLInputSource
from a URL.- Parameters:
aURL
- URL to read from- Throws:
IOException
- if an I/O error occurs
-
-
Method Details
-
getInputStream
Gets the InputStream from which to read an XML document.- Returns:
- an InputStream from which an XML document may be read
-
getRelativePathBase
Deprecated.UsegetURL()
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
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
Closes the underlyingInputStream
.- Throws:
IOException
- if an I/O error occurs.
-
getURL()
instead.