public class DocTypeReader extends Reader
DOCTYPE declaration in an XML stream. Often it is
inconvenient to specify a DOCTYPE in XML files -- you many
want the option of parsing the files without reading the DTD, the files
may move around, making placing a DOCTYPE path to the DTD in
them unattractive, and you may have many files, making an in-line include
of the DTD unattractive as well. This class makes
it possible to maintain XML files without any DOCTYPE
declaration, then dynamically include the DOCTYPE information
at runtime.
If the XML stream already contains a DOCTYPE declaration,
the reader will not add an additional one.
The DOCTYPE information given to the reader will be placed
in the XML stream it wraps just before the root element of the document.
Note that all methods other than the various forms of read
apply onto the underlying XML stream and should not be used until the
header and doc type have been read.| Constructor and Description |
|---|
DocTypeReader(Reader xml,
Reader docType)
Construct the reader with an XML stream, and set the
DOCTYPE information to be included. |
| Modifier and Type | Method and Description |
|---|---|
void |
close() |
void |
mark(int readAheadLimit) |
boolean |
markSupported() |
int |
read() |
int |
read(char[] buf) |
int |
read(char[] buf,
int off,
int len) |
boolean |
ready() |
void |
reset() |
long |
skip(long len) |
public DocTypeReader(Reader xml, Reader docType) throws IOException
DOCTYPE information to be included. The given
reader should access an input source containing the exact declaration
to include, such as:<DOCTYPE schedule SYSTEM "schedule.dtd"><DOCTYPE html PUBLIC "-//W3C//DTD XHTML ...><DOCTYPE stock-price [ <ELEMENT symb ... ]>DOCTYPE information will be
included in the stream.IOExceptionpublic int read()
throws IOException
read in class ReaderIOExceptionpublic int read(char[] buf)
throws IOException
read in class ReaderIOExceptionpublic int read(char[] buf,
int off,
int len)
throws IOException
read in class ReaderIOExceptionpublic long skip(long len)
throws IOException
skip in class ReaderIOExceptionpublic boolean ready()
throws IOException
ready in class ReaderIOExceptionpublic boolean markSupported()
markSupported in class Readerpublic void mark(int readAheadLimit)
throws IOException
mark in class ReaderIOExceptionpublic void reset()
throws IOException
reset in class ReaderIOExceptionpublic void close()
throws IOException
close in interface Closeableclose in interface AutoCloseableclose in class ReaderIOExceptionCopyright © 2006–2018 Apache Software Foundation. All rights reserved.