com.raritantechnologies.HTML.filter
Class HTMLFilter

java.lang.Object
  extended byjavax.swing.text.html.HTMLEditorKit.ParserCallback
      extended bycom.raritantechnologies.HTML.filter.HTMLFilter
All Implemented Interfaces:
IConfigurable, IStringFilter

public class HTMLFilter
extends javax.swing.text.html.HTMLEditorKit.ParserCallback
implements IConfigurable, IStringFilter

General purpose HTML Filter. Uses the javax.swing.text.html.HTMLEditorKit.

Parses an HTML page into a list of HTMLEvents. This list can then be modified by one or more HTMLEventProcessor objects. The modified HTML events are then used to reconstruct a filtered version of the original HTML.

XML Configuration Template:
  <HTMLFilter>
    <!-- One or more EventProcessor elements: -->
    <EventProcessor class="[ class of com.raritantechnologies.HTML.filter.HTMLEventProcessor ]" >
      <!-- configuration parameters for EventProcessor -->
    </EventProcessor>

    <EventProcessor class="[ class of com.raritantechnologies.HTML.filter.HTMLEventProcessor ]" >
      <!-- configuration parameters for EventProcessor -->
    </EventProcessor>

    <!-- etc... -->

  </HTMLFilter>
 

Developed by Raritan Technologies Inc..

Author:
Ted Sullivan

Field Summary
 
Fields inherited from class javax.swing.text.html.HTMLEditorKit.ParserCallback
IMPLIED
 
Fields inherited from interface com.raritantechnologies.utils.filter.IStringFilter
TEMPLATE
 
Constructor Summary
HTMLFilter()
           
HTMLFilter(boolean printHTMLErrors)
           
HTMLFilter(boolean printHTMLErrors, boolean printHTMLWarnings)
           
 
Method Summary
 void addEvent(HTMLEvent event)
           
 void addProcessor(HTMLEventProcessor processor)
           
 java.lang.String filterString(java.util.Map parameters, java.lang.String inputString)
           
 java.lang.String filterString(java.lang.String html)
           
 java.lang.String filterString(java.lang.String sessionID, java.lang.String inputString)
           
 java.lang.String getConfigurationXML()
           
 java.lang.String getConfigurationXML(java.lang.String configurationTemplate)
           
 java.lang.String getHTML()
           
 void handleComment(char[] data, int pos)
           
 void handleEndTag(javax.swing.text.html.HTML.Tag tag, int pos)
           
 void handleError(java.lang.String errorMsg, int pos)
           
 void handleSimpleTag(javax.swing.text.html.HTML.Tag tag, javax.swing.text.MutableAttributeSet mutableAttrSet, int pos)
           
 void handleStartTag(javax.swing.text.html.HTML.Tag tag, javax.swing.text.MutableAttributeSet mutableAttrSet, int pos)
           
 void handleText(char[] data, int pos)
           
 void initialize(org.w3c.dom.Element elem)
          Initializes the object from an XML tag or element.
 void parse(java.io.Reader htmlReader)
           
 void processEvent(HTMLEvent event)
           
 java.lang.String processHTML(java.io.Reader htmlReader)
           
 java.lang.String processHTML(java.lang.String html)
           
 
Methods inherited from class javax.swing.text.html.HTMLEditorKit.ParserCallback
flush, handleEndOfLineString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HTMLFilter

public HTMLFilter()

HTMLFilter

public HTMLFilter(boolean printHTMLErrors)

HTMLFilter

public HTMLFilter(boolean printHTMLErrors,
                  boolean printHTMLWarnings)
Method Detail

parse

public void parse(java.io.Reader htmlReader)

processHTML

public java.lang.String processHTML(java.lang.String html)

processHTML

public java.lang.String processHTML(java.io.Reader htmlReader)

filterString

public java.lang.String filterString(java.lang.String html)
Specified by:
filterString in interface IStringFilter

filterString

public java.lang.String filterString(java.lang.String sessionID,
                                     java.lang.String inputString)
Specified by:
filterString in interface IStringFilter

filterString

public java.lang.String filterString(java.util.Map parameters,
                                     java.lang.String inputString)
Specified by:
filterString in interface IStringFilter

handleError

public void handleError(java.lang.String errorMsg,
                        int pos)

handleSimpleTag

public void handleSimpleTag(javax.swing.text.html.HTML.Tag tag,
                            javax.swing.text.MutableAttributeSet mutableAttrSet,
                            int pos)

handleStartTag

public void handleStartTag(javax.swing.text.html.HTML.Tag tag,
                           javax.swing.text.MutableAttributeSet mutableAttrSet,
                           int pos)

handleEndTag

public void handleEndTag(javax.swing.text.html.HTML.Tag tag,
                         int pos)

handleText

public void handleText(char[] data,
                       int pos)

handleComment

public void handleComment(char[] data,
                          int pos)

processEvent

public void processEvent(HTMLEvent event)

addEvent

public void addEvent(HTMLEvent event)

addProcessor

public void addProcessor(HTMLEventProcessor processor)

getHTML

public java.lang.String getHTML()

initialize

public void initialize(org.w3c.dom.Element elem)
Description copied from interface: IConfigurable
Initializes the object from an XML tag or element. This method is called by the Framework as part of the application initializtion. see ConfigurationManager, XMLConfigurationManager, XMLSearchFieldMapFactory, XMLSearchSourceFactory. Configurable objects that are owned or contained by other configurable objects will be initialized in by the parent object.

Specified by:
initialize in interface IConfigurable

getConfigurationXML

public java.lang.String getConfigurationXML()
Specified by:
getConfigurationXML in interface IStringFilter

getConfigurationXML

public java.lang.String getConfigurationXML(java.lang.String configurationTemplate)
Specified by:
getConfigurationXML in interface IStringFilter