|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.xerces.xinclude.XIncludeTextReader
This class is used for reading resources requested in <include> elements, when the parse attribute of the <include> element is "text". Using this class will open the location, detect the encoding, and discard the byte order mark, if applicable. REVISIT: Much of the code in this class is taken from XMLEntityManager. It would be nice if this code could be shared in some way. However, since XMLEntityManager is used for reading files as XML, and this needs to read files as text, there would need to be some refactoring done.
XIncludeHandler
Constructor Summary | |
---|---|
XIncludeTextReader(org.apache.xerces.xni.parser.XMLInputSource source,
XIncludeHandler handler)
Construct the XIncludeReader using the XMLInputSource and XIncludeHandler. |
Method Summary | |
---|---|
void |
close()
Closes the stream. |
protected void |
consumeBOM(java.io.InputStream stream,
java.lang.String encoding)
Removes the byte order mark from the stream, if it exists. |
protected java.lang.String |
getEncodingName(byte[] b4)
REVISIT: This code is taken from org.apache.xerces.impl.XMLEntityManager. |
protected java.lang.String |
getEncodingName(java.io.InputStream stream)
XMLEntityManager cares about endian-ness, since it creates its own optimized readers. |
protected java.io.Reader |
getReader(org.apache.xerces.xni.parser.XMLInputSource source)
Return the Reader for given XMLInputSource. |
protected boolean |
isValid(int ch)
Returns true if the specified character is a valid XML character as per the rules of XML 1.0. |
void |
parse()
Read the input stream as text, and pass the text on to the XIncludeHandler using calls to characters(). |
void |
setErrorReporter(XMLErrorReporter errorReporter)
Sets the XMLErrorReporter used for reporting errors while reading the text include. |
void |
setHttpProperties(java.lang.String accept,
java.lang.String acceptCharset,
java.lang.String acceptLanguage)
Sets content negotation parameters to be attached to an HTTP request. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public XIncludeTextReader(org.apache.xerces.xni.parser.XMLInputSource source, XIncludeHandler handler) throws java.io.IOException
source
- The XMLInputSource to use.handler
- The XIncludeHandler to use.Method Detail |
public void setErrorReporter(XMLErrorReporter errorReporter)
errorReporter
- the XMLErrorReporter to be used for
reporting errors.public void setHttpProperties(java.lang.String accept, java.lang.String acceptCharset, java.lang.String acceptLanguage)
accept
- the Accept HTTP request propertyacceptCharset
- the Accept-Charset HTTP request propertyacceptLanguage
- the Accept-Language HTTP request propertyprotected java.io.Reader getReader(org.apache.xerces.xni.parser.XMLInputSource source) throws java.io.IOException
source
- The XMLInputSource to use.
java.io.IOException
protected java.lang.String getEncodingName(java.io.InputStream stream) throws java.io.IOException
java.io.IOException
protected void consumeBOM(java.io.InputStream stream, java.lang.String encoding) throws java.io.IOException
stream
- encoding
-
java.io.IOException
protected java.lang.String getEncodingName(byte[] b4)
b4
- The first four bytes of the input.
public void parse() throws java.io.IOException
java.io.IOException
public void close() throws java.io.IOException
java.io.IOException
protected boolean isValid(int ch)
ch
- The character to check.
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |