public class DocTypeReader
extends java.io.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(java.io.Reader xml,
java.io.Reader docType)
Construct the reader with an XML stream, and set the
DOCTYPE information to be included. |
public DocTypeReader(java.io.Reader xml,
java.io.Reader docType)
throws java.io.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.java.io.IOExceptionpublic int read()
throws java.io.IOException
read in class java.io.Readerjava.io.IOExceptionpublic int read(char[] buf)
throws java.io.IOException
read in class java.io.Readerjava.io.IOExceptionpublic int read(char[] buf,
int off,
int len)
throws java.io.IOException
read in class java.io.Readerjava.io.IOExceptionpublic long skip(long len)
throws java.io.IOException
skip in class java.io.Readerjava.io.IOExceptionpublic boolean ready()
throws java.io.IOException
ready in class java.io.Readerjava.io.IOExceptionpublic boolean markSupported()
markSupported in class java.io.Readerpublic void mark(int readAheadLimit)
throws java.io.IOException
mark in class java.io.Readerjava.io.IOExceptionpublic void reset()
throws java.io.IOException
reset in class java.io.Readerjava.io.IOExceptionpublic void close()
throws java.io.IOException
close in interface java.io.Closeableclose in interface java.lang.AutoCloseableclose in class java.io.Readerjava.io.IOExceptionCopyright © 2006-2013 Apache Software Foundation. All Rights Reserved.