Package org.apache.openjpa.lib.xml
Class DocTypeReader
java.lang.Object
java.io.Reader
org.apache.openjpa.lib.xml.DocTypeReader
- All Implemented Interfaces:
Closeable,AutoCloseable,Readable
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
-
Field Summary
-
Constructor Summary
ConstructorsConstructorDescriptionDocTypeReader(Reader xml, Reader docType) Construct the reader with an XML stream, and set theDOCTYPEinformation to be included. -
Method Summary
Methods inherited from class java.io.Reader
nullReader, read, transferTo
-
Constructor Details
-
DocTypeReader
Construct the reader with an XML stream, and set theDOCTYPEinformation 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 ... ]>
If the reader is null, noDOCTYPEinformation will be included in the stream.- Throws:
IOException
-
-
Method Details
-
read
- Overrides:
readin classReader- Throws:
IOException
-
read
- Overrides:
readin classReader- Throws:
IOException
-
read
- Specified by:
readin classReader- Throws:
IOException
-
skip
- Overrides:
skipin classReader- Throws:
IOException
-
ready
- Overrides:
readyin classReader- Throws:
IOException
-
markSupported
public boolean markSupported()- Overrides:
markSupportedin classReader
-
mark
- Overrides:
markin classReader- Throws:
IOException
-
reset
- Overrides:
resetin classReader- Throws:
IOException
-
close
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Specified by:
closein classReader- Throws:
IOException
-