Package org.custommonkey.xmlunit
Class DoctypeReader
- java.lang.Object
-
- java.io.Reader
-
- org.custommonkey.xmlunit.DoctypeReader
-
- All Implemented Interfaces:
java.io.Closeable,java.lang.AutoCloseable,java.lang.Readable
public class DoctypeReader extends java.io.ReaderAdapts the marked-up content in a source Reader to specify that it conforms to a different DTD. Combines Reader semantics with the ability to specify a target doctype for a character stream containing XML markup. Used by Validator class to wrap a Reader when performing validation of a document against a DTD.
Examples and more at xmlunit.sourceforge.net
-
-
Constructor Summary
Constructors Constructor Description DoctypeReader(java.io.Reader originalSource, java.lang.String doctypeName, java.lang.String systemID)Create a Reader whose XML content is provided by the originalSource with the exception of the DOCTYPE which is provided by the doctypeName and systemID.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description voidclose()protected java.lang.StringgetContent()intread()Read DOCTYPE-replaced content from the wrapped Readerintread(char[] cbuf, int off, int len)Read DOCTYPE-replaced content from the wrapped Readerjava.lang.StringreplaceDoctype(java.lang.StringBuffer withinContent, java.lang.String doctypeName, java.lang.String systemId)Deprecated.this method is only here for BWC, it is no longer used by this class
-
-
-
Constructor Detail
-
DoctypeReader
public DoctypeReader(java.io.Reader originalSource, java.lang.String doctypeName, java.lang.String systemID)Create a Reader whose XML content is provided by the originalSource with the exception of the DOCTYPE which is provided by the doctypeName and systemID.- Parameters:
originalSource-doctypeName-systemID-
-
-
Method Detail
-
getContent
protected java.lang.String getContent() throws java.io.IOException- Returns:
- the content of the original source, without amendments or substitutions. Safe to call multiple times.
- Throws:
java.io.IOException- if thrown while reading from the original source
-
replaceDoctype
public java.lang.String replaceDoctype(java.lang.StringBuffer withinContent, java.lang.String doctypeName, java.lang.String systemId)Deprecated.this method is only here for BWC, it is no longer used by this classPerform DOCTYPE amendment / addition within some marked-up content- Parameters:
withinContent-doctypeName-systemId-- Returns:
- the content, after DOCTYPE amendment / addition
-
read
public int read(char[] cbuf, int off, int len) throws java.io.IOExceptionRead DOCTYPE-replaced content from the wrapped Reader- Specified by:
readin classjava.io.Reader- Parameters:
cbuf-off-len-- Returns:
- The number of characters read, or -1 if the end of the stream has been reached
- Throws:
java.io.IOException
-
read
public int read() throws java.io.IOExceptionRead DOCTYPE-replaced content from the wrapped Reader- Overrides:
readin classjava.io.Reader- Throws:
java.io.IOException
-
close
public void close() throws java.io.IOException- Specified by:
closein interfacejava.lang.AutoCloseable- Specified by:
closein interfacejava.io.Closeable- Specified by:
closein classjava.io.Reader- Throws:
java.io.IOException
-
-