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
ConstructorDescriptionDocTypeReader
(Reader xml, Reader docType) Construct the reader with an XML stream, and set theDOCTYPE
information 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 theDOCTYPE
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 ... ]>
If the reader is null, noDOCTYPE
information will be included in the stream.- Throws:
IOException
-
-
Method Details
-
read
- Overrides:
read
in classReader
- Throws:
IOException
-
read
- Overrides:
read
in classReader
- Throws:
IOException
-
read
- Specified by:
read
in classReader
- Throws:
IOException
-
skip
- Overrides:
skip
in classReader
- Throws:
IOException
-
ready
- Overrides:
ready
in classReader
- Throws:
IOException
-
markSupported
public boolean markSupported()- Overrides:
markSupported
in classReader
-
mark
- Overrides:
mark
in classReader
- Throws:
IOException
-
reset
- Overrides:
reset
in classReader
- Throws:
IOException
-
close
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Specified by:
close
in classReader
- Throws:
IOException
-