public class XMLInputSource extends Object
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 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. |
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.
|
public XMLInputSource(File aFile) throws IOException
XMLInputSource
from a descriptor file.aFile
- file to read fromIOException
- if an I/O error occurspublic XMLInputSource(String aUrlOrFileName) throws IOException
XMLInputSource
from a descriptor file.aUrlOrFileName
- a URL or a file name to read fromIOException
- if an I/O error occurspublic XMLInputSource(InputStream aInputStream, File aRelativePathBase)
aInputStream
- input stream from which to readaRelativePathBase
- base for resolving relative paths. This must be a directory.public XMLInputSource(URL aURL) throws IOException
XMLInputSource
from a URL.aURL
- URL to read fromIOException
- if an I/O error occurspublic InputStream getInputStream()
@Deprecated public File getRelativePathBase()
getURL()
instead.null
if none has been specified.public URL getURL()
null
if none has been specified.public void close() throws IOException
InputStream
.IOException
- if an I/O error occurs.Copyright © 2006–2017 The Apache Software Foundation. All rights reserved.