|
SAP NetWeaver '04 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
Reads HTML documents and generates events.
The IHTMLReader generates events for HTML documents. Events are sent to the
IHTMLContentHandler. There can be only
one content handler per reader.
A document is parsed by first setting the input source and then calling
parse() once or parseNextEvent() repeatedly. parseNextEvent()
parses the document until the next event was sent to the
content handler and then returns to the caller. It is not garantueed that
exactly one event is generated.
Input Sources and Encodings:
Reader is used as input source, no attempt is
made to detect the encoding of the html document. getEncoding() will
return null in that case. InputStream together with an encoding is used,
any encoding specified in meta tags of the document is ignored
and the given encoding is used. InputStream together without encoding is used,
the reader will look into the first n octets of the html document to detect
a HTML meta tag with Content-Type which specifies the
character set to use. If no encoding is found, ISO-8859-1 is assumed. The
number of octets used for encoding detection is implementation defined.
Note that implementations of this class are not multithread-safe .
Copyright (c) SAP AG 2001-2002
| Method Summary | |
void |
discard()
Free all allocated resources. |
IHTMLContentHandler |
getContentHandler()
Get the registered content handler. |
java.lang.String |
getEncoding()
Return the encoding used in the document. |
void |
parse()
Parse the complete document, generating events, until the source is read emtpy. |
boolean |
parseNextEvent()
Parse the document, generating an events, and return to the caller. |
void |
setContentHandler(IHTMLContentHandler handler)
Set the content handler to a new value. |
void |
setSource(java.io.InputStream input)
Set InputStream as document source. |
void |
setSource(java.io.InputStream input,
java.lang.String encoding)
Set InputStream as document source, use the given encoding. |
void |
setSource(java.io.Reader input)
Set Reader as document source, encoding is irrelevant. |
| Method Detail |
public IHTMLContentHandler getContentHandler()
null if none is
installed.public void setContentHandler(IHTMLContentHandler handler)
null is allowed to
deregister an installed handler.handler - to register
public java.lang.String getEncoding()
throws HTMLException,
java.io.IOException
null if unknown.HTMLException - when document is not legal HTMLjava.io.IOException - on read errors
public void setSource(java.io.InputStream input)
throws HTMLException,
java.io.IOException
input - stream to read document fromHTMLException - when document is not legal HTMLjava.io.IOException - on read errors
public void setSource(java.io.InputStream input,
java.lang.String encoding)
throws HTMLException,
java.io.IOException
input - stream to read document fromencoding - to use for streamHTMLException - when document is not legal HTMLjava.io.IOException - on read errors
public void setSource(java.io.Reader input)
throws HTMLException,
java.io.IOException
input - to read document fromHTMLException - when document is not legal HTMLjava.io.IOException - on read errors
public void parse()
throws HTMLException,
java.io.IOException
HTMLException - when document is not legal HTMLjava.io.IOException - on read errors
public boolean parseNextEvent()
throws HTMLException,
java.io.IOException
HTMLException - when document is not legal HTMLjava.io.IOException - on read errorspublic void discard()
|
SAP NetWeaver '04 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||