Package org.apache.uima.util
Class XMLInputSource
- java.lang.Object
-
- org.apache.uima.util.XMLInputSource
-
public class XMLInputSource extends java.lang.Object
An input source used by theXMLParser
to read XML documents for parsing.The application uses the
XMLInputSource(File)
constructor to create anXMLInputSource
from a descriptorFile
. Alternatively, if the source of the XML is not a file, theXMLInputSource(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.
-
-
Field Summary
Fields Modifier and Type Field Description private java.io.InputStream
mInputStream
InputStream from which the XML document is read.private java.net.URL
mURL
URL that we're parsing from
-
Constructor Summary
Constructors Constructor Description XMLInputSource(java.io.File aFile)
Creates anXMLInputSource
from a descriptor file.XMLInputSource(java.io.InputStream aInputStream, java.io.File aRelativePathBase)
Creates an XMLInputSource from an existing InputStream.XMLInputSource(java.lang.String aUrlOrFileName)
Creates anXMLInputSource
from a descriptor file.XMLInputSource(java.net.URL aURL)
Creates anXMLInputSource
from a URL.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description void
close()
Closes the underlyingInputStream
.java.io.InputStream
getInputStream()
Gets the InputStream from which to read an XML document.java.io.File
getRelativePathBase()
Deprecated.UsegetURL()
instead.java.net.URL
getURL()
Gets the base for resolving relative paths.
-
-
-
Constructor Detail
-
XMLInputSource
public XMLInputSource(java.io.File aFile) throws java.io.IOException
Creates anXMLInputSource
from a descriptor file.- Parameters:
aFile
- file to read from- Throws:
java.io.IOException
- if an I/O error occurs
-
XMLInputSource
public XMLInputSource(java.lang.String aUrlOrFileName) throws java.io.IOException
Creates anXMLInputSource
from a descriptor file.- Parameters:
aUrlOrFileName
- a URL or a file name to read from- Throws:
java.io.IOException
- if an I/O error occurs
-
XMLInputSource
public XMLInputSource(java.io.InputStream aInputStream, java.io.File aRelativePathBase)
Creates an XMLInputSource from an existing InputStream.- Parameters:
aInputStream
- input stream from which to readaRelativePathBase
- base for resolving relative paths. This must be a directory.
-
XMLInputSource
public XMLInputSource(java.net.URL aURL) throws java.io.IOException
Creates anXMLInputSource
from a URL.- Parameters:
aURL
- URL to read from- Throws:
java.io.IOException
- if an I/O error occurs
-
-
Method Detail
-
getInputStream
public java.io.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 java.io.File 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
public java.net.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 java.io.IOException
Closes the underlyingInputStream
.- Throws:
java.io.IOException
- if an I/O error occurs.
-
-