Package org.apache.uima.util
Class XMLInputSource
- java.lang.Object
-
- org.apache.uima.util.XMLInputSource
-
public class XMLInputSource extends java.lang.ObjectAn input source used by theXMLParserto read XML documents for parsing.The application uses the
XMLInputSource(File)constructor to create anXMLInputSourcefrom 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.
-
-
Constructor Summary
Constructors Constructor Description XMLInputSource(java.io.File aFile)Creates anXMLInputSourcefrom 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 anXMLInputSourcefrom a descriptor file.XMLInputSource(java.net.URL aURL)Creates anXMLInputSourcefrom a URL.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description voidclose()Closes the underlyingInputStream.java.io.InputStreamgetInputStream()Gets the InputStream from which to read an XML document.java.io.FilegetRelativePathBase()Deprecated.UsegetURL()instead.java.net.URLgetURL()Gets the base for resolving relative paths.
-
-
-
Constructor Detail
-
XMLInputSource
public XMLInputSource(java.io.File aFile) throws java.io.IOExceptionCreates anXMLInputSourcefrom 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.IOExceptionCreates anXMLInputSourcefrom 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.IOExceptionCreates anXMLInputSourcefrom 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,
nullif 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,
nullif none has been specified.
-
close
public void close() throws java.io.IOExceptionCloses the underlyingInputStream.- Throws:
java.io.IOException- if an I/O error occurs.
-
-