SAP NetWeaver '04

com.sapportals.wcm.util.html
Interface IHTMLReader

[contained in: com.sap.netweaver.bc.util.par - bc.util.public_api.jar]
All Known Subinterfaces:
IHTMLFilter

public interface IHTMLReader

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:

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

getContentHandler

public IHTMLContentHandler getContentHandler()
Get the registered content handler. Returns null if none is installed.
Returns:
registered content handler

setContentHandler

public void setContentHandler(IHTMLContentHandler handler)
Set the content handler to a new value. null is allowed to deregister an installed handler.
Parameters:
handler - to register

getEncoding

public java.lang.String getEncoding()
                             throws HTMLException,
                                    java.io.IOException
Return the encoding used in the document.
Returns:
encoding used in document or null if unknown.
Throws:
HTMLException - when document is not legal HTML
java.io.IOException - on read errors

setSource

public void setSource(java.io.InputStream input)
               throws HTMLException,
                      java.io.IOException
Set InputStream as document source. Encoding will be detected.
Parameters:
input - stream to read document from
Throws:
HTMLException - when document is not legal HTML
java.io.IOException - on read errors

setSource

public void setSource(java.io.InputStream input,
                      java.lang.String encoding)
               throws HTMLException,
                      java.io.IOException
Set InputStream as document source, use the given encoding.
Parameters:
input - stream to read document from
encoding - to use for stream
Throws:
HTMLException - when document is not legal HTML
java.io.IOException - on read errors

setSource

public void setSource(java.io.Reader input)
               throws HTMLException,
                      java.io.IOException
Set Reader as document source, encoding is irrelevant.
Parameters:
input - to read document from
Throws:
HTMLException - when document is not legal HTML
java.io.IOException - on read errors

parse

public void parse()
           throws HTMLException,
                  java.io.IOException
Parse the complete document, generating events, until the source is read emtpy.
Throws:
HTMLException - when document is not legal HTML
java.io.IOException - on read errors

parseNextEvent

public boolean parseNextEvent()
                       throws HTMLException,
                              java.io.IOException
Parse the document, generating an events, and return to the caller. Will return true as long as there are more events to read.
Returns:
if there are more events to read
Throws:
HTMLException - when document is not legal HTML
java.io.IOException - on read errors

discard

public void discard()
Free all allocated resources. Not necessary to call when parsing has finished.

SAP NetWeaver '04

Copyright © 2004 by SAP AG. All Rights Reserved.
SAP, R/3, mySAP, mySAP.com, xApps, xApp, SAP NetWeaver, and other SAP products and services mentioned herein as well as their respective logos are trademarks or registered trademarks of SAP AG in Germany and in several other countries all over the world. All other product and service names mentioned are the trademarks of their respective companies. Data contained in this document serves informational purposes only. National product specifications may vary.

These materials are subject to change without notice. These materials are provided by SAP AG and its affiliated companies ("SAP Group") for informational purposes only, without representation or warranty of any kind, and SAP Group shall not be liable for errors or omissions with respect to the materials. The only warranties for SAP Group products and services are those that are set forth in the express warranty statements accompanying such products and services, if any. Nothing herein should be construed as constituting an additional warranty.