Class DocTypeReader

java.lang.Object
java.io.Reader
org.apache.openjpa.lib.xml.DocTypeReader
All Implemented Interfaces:
Closeable, AutoCloseable, Readable

public class DocTypeReader extends Reader
The DocTypeReader can be used to dynamically include a 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.
Author:
Abe White