edu.wisc.my.webproxy.beans.filtering
Class ClippingFilter

java.lang.Object
  extended by org.xml.sax.helpers.XMLFilterImpl
      extended by edu.wisc.my.webproxy.beans.filtering.ChainingSaxFilter
          extended by edu.wisc.my.webproxy.beans.filtering.ClippingFilter
All Implemented Interfaces:
ProxyComponent, ContentHandler, DTDHandler, EntityResolver, ErrorHandler, LexicalHandler, XMLFilter, XMLReader

public class ClippingFilter
extends ChainingSaxFilter

The clipping filter uses an XPath expression to clip a subset of the Document

Version:
$Id: ClippingFilter.java 20993 2010-07-02 19:32:47Z edalquist $
Author:
dgirmwood

Constructor Summary
ClippingFilter()
          The default constructor
ClippingFilter(XMLReader parent)
          Constructor that takes XMLReader object as argument
 
Method Summary
 void characters(char[] ch, int start, int len)
           
 void comment(char[] ch, int start, int length)
           
 void endElement(String uri, String localName, String qName)
          Filters the Namespace URI for end-element events.
 String getName()
          Returns a displayable name for the component.
 List<List<String>> getXPath()
          Retrives the Xpath set on this clipping filter
 boolean notAcceptable(String qName)
          Checks to see if element is in notAcceptable array
 void setAcceptableQNames(Set notAcceptable)
           
 void setActionData(javax.portlet.ActionRequest request, javax.portlet.ActionResponse response)
          This method is called on a component that is being used by the portlet at the begining of the action request it will be used in.
 void setComments(String[] newComments)
          Set the comment for this clipping filter
 void setElement(String[] newElement)
          Set elemets Lists for clipping
 void setRenderData(javax.portlet.RenderRequest request, javax.portlet.RenderResponse response)
          This method is called on a component that is being used by the portlet at the begining of the render request it will be used in.
 void setXPath(String[] path)
          Set xPath Lists for clipping
 void startElement(String uri, String localName, String qName, Attributes atts)
          Filters the Namespace URI for start-element events.
 
Methods inherited from class edu.wisc.my.webproxy.beans.filtering.ChainingSaxFilter
clearData, endCDATA, endDTD, endEntity, getLexicalHandler, parse, parse, setLexicalHandler, setParent, startCDATA, startDTD, startEntity
 
Methods inherited from class org.xml.sax.helpers.XMLFilterImpl
endDocument, endPrefixMapping, error, fatalError, getContentHandler, getDTDHandler, getEntityResolver, getErrorHandler, getFeature, getParent, getProperty, ignorableWhitespace, notationDecl, processingInstruction, resolveEntity, setContentHandler, setDocumentLocator, setDTDHandler, setEntityResolver, setErrorHandler, setFeature, setProperty, skippedEntity, startDocument, startPrefixMapping, unparsedEntityDecl, warning
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ClippingFilter

public ClippingFilter()
The default constructor


ClippingFilter

public ClippingFilter(XMLReader parent)
Constructor that takes XMLReader object as argument

Parameters:
parent - the (@link XMLReader) object
Method Detail

setXPath

public void setXPath(String[] path)
Set xPath Lists for clipping

Parameters:
path - array of Strings containing paths

setElement

public void setElement(String[] newElement)
Set elemets Lists for clipping

Parameters:
newElement - array of Strings containing elements

setComments

public void setComments(String[] newComments)
Set the comment for this clipping filter

Parameters:
newComments - array of Strings containing comments

getXPath

public List<List<String>> getXPath()
Retrives the Xpath set on this clipping filter

Returns:
xPath an array of LinkedList containing xPaths

startElement

public void startElement(String uri,
                         String localName,
                         String qName,
                         Attributes atts)
                  throws SAXException
Filters the Namespace URI for start-element events.

Specified by:
startElement in interface ContentHandler
Overrides:
startElement in class XMLFilterImpl
Parameters:
uri - The element's Namespace URI, or the empty string.
localName - The element's local name, or the empty string.
qName - The element's qualified (prefixed) name, or the empty string.
Throws:
SAXException

endElement

public void endElement(String uri,
                       String localName,
                       String qName)
                throws SAXException
Filters the Namespace URI for end-element events.

Specified by:
endElement in interface ContentHandler
Overrides:
endElement in class XMLFilterImpl
Parameters:
uri - The element's Namespace URI, or the empty string.
localName - The element's local name, or the empty string.
qName - The element's qualified (prefixed) name, or the empty string.
Throws:
SAXException

characters

public void characters(char[] ch,
                       int start,
                       int len)
                throws SAXException
Specified by:
characters in interface ContentHandler
Overrides:
characters in class ChainingSaxFilter
Throws:
SAXException
See Also:
XMLFilterImpl.characters(char[], int, int)

setAcceptableQNames

public void setAcceptableQNames(Set notAcceptable)

notAcceptable

public boolean notAcceptable(String qName)
Checks to see if element is in notAcceptable array

Parameters:
qName - the qName as String

comment

public void comment(char[] ch,
                    int start,
                    int length)
             throws SAXException
Specified by:
comment in interface LexicalHandler
Overrides:
comment in class ChainingSaxFilter
Throws:
SAXException
See Also:
LexicalHandler.comment(char[], int, int)

getName

public String getName()
Description copied from interface: ProxyComponent
Returns a displayable name for the component.


setRenderData

public void setRenderData(javax.portlet.RenderRequest request,
                          javax.portlet.RenderResponse response)
Description copied from interface: ProxyComponent
This method is called on a component that is being used by the portlet at the begining of the render request it will be used in. It provides the component with a reference to the request and response objects to use.

Specified by:
setRenderData in interface ProxyComponent
Overrides:
setRenderData in class ChainingSaxFilter

setActionData

public void setActionData(javax.portlet.ActionRequest request,
                          javax.portlet.ActionResponse response)
Description copied from interface: ProxyComponent
This method is called on a component that is being used by the portlet at the begining of the action request it will be used in. It provides the component with a reference to the request and response objects to use.

Specified by:
setActionData in interface ProxyComponent
Overrides:
setActionData in class ChainingSaxFilter


Copyright © 2010 Jasig. All Rights Reserved.