org.apache.cocoon.transformation
Class FilterTransformer

java.lang.Object
  |
  +--org.apache.avalon.framework.logger.AbstractLoggable
        |
        +--org.apache.cocoon.xml.AbstractXMLProducer
              |
              +--org.apache.cocoon.xml.AbstractXMLPipe
                    |
                    +--org.apache.cocoon.transformation.AbstractTransformer
                          |
                          +--org.apache.cocoon.transformation.FilterTransformer
All Implemented Interfaces:
org.apache.avalon.framework.component.Component, org.xml.sax.ContentHandler, org.xml.sax.ext.LexicalHandler, org.apache.avalon.framework.logger.Loggable, org.apache.avalon.excalibur.pool.Poolable, org.apache.avalon.excalibur.pool.Recyclable, SitemapModelComponent, Transformer, XMLConsumer, XMLPipe, XMLProducer

public class FilterTransformer
extends AbstractTransformer
implements org.apache.avalon.excalibur.pool.Poolable

The filter transformer can be used to let only an amount of elements through in a given block. Usage in sitemap <map:transform type="filter"> <map:parameter name="element-name" value="row"/> <map:parameter name="count" value="5"/> <map:parameter name="blocknr" value="3"/> </map:transform> Only the 3th block will be shown, containing only 5 row elements.

Version:
CVS $Revision: 1.1.2.5 $ $Date: 2001/10/11 08:56:15 $ $Author: cziegeler $
Author:
Sven Beauprez

Field Summary
protected  java.lang.String elementName
           
 
Fields inherited from class org.apache.cocoon.xml.AbstractXMLProducer
contentHandler, lexicalHandler, xmlConsumer
 
Fields inherited from interface org.apache.cocoon.transformation.Transformer
ROLE
 
Constructor Summary
FilterTransformer()
           
 
Method Summary
 void characters(char[] c, int start, int len)
          Receive notification of character data.
 void comment(char[] ch, int start, int len)
          Report an XML comment anywhere in the document.
 void endCDATA()
          Report the end of a CDATA section.
 void endElement(java.lang.String uri, java.lang.String name, java.lang.String raw)
          Receive notification of the end of an element.
 void endEntity(java.lang.String name)
          Report the end of an entity.
protected  boolean isSkipping()
          END SitemapComponent methods
 void processingInstruction(java.lang.String target, java.lang.String data)
          Receive notification of a processing instruction.
 void setup(SourceResolver resolver, java.util.Map objectModel, java.lang.String source, org.apache.avalon.framework.parameters.Parameters parameters)
          BEGIN SitemapComponent methods
 void startCDATA()
          Report the start of a CDATA section.
 void startElement(java.lang.String uri, java.lang.String name, java.lang.String raw, org.xml.sax.Attributes attributes)
          BEGIN SAX ContentHandler handlers
 void startEntity(java.lang.String name)
          Report the beginning of an entity.
 
Methods inherited from class org.apache.cocoon.xml.AbstractXMLPipe
endDocument, endDTD, endPrefixMapping, ignorableWhitespace, setDocumentLocator, skippedEntity, startDocument, startDTD, startPrefixMapping
 
Methods inherited from class org.apache.cocoon.xml.AbstractXMLProducer
recycle, setConsumer, setContentHandler, setLexicalHandler
 
Methods inherited from class org.apache.avalon.framework.logger.AbstractLoggable
getLogger, setLogger, setupLogger, setupLogger, setupLogger
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.xml.sax.ContentHandler
endDocument, endPrefixMapping, ignorableWhitespace, setDocumentLocator, skippedEntity, startDocument, startPrefixMapping
 
Methods inherited from interface org.xml.sax.ext.LexicalHandler
endDTD, startDTD
 
Methods inherited from interface org.apache.cocoon.xml.XMLProducer
setConsumer
 
Methods inherited from interface org.apache.avalon.excalibur.pool.Recyclable
recycle
 

Field Detail

elementName

protected java.lang.String elementName
Constructor Detail

FilterTransformer

public FilterTransformer()
Method Detail

setup

public void setup(SourceResolver resolver,
                  java.util.Map objectModel,
                  java.lang.String source,
                  org.apache.avalon.framework.parameters.Parameters parameters)
           throws ProcessingException,
                  org.xml.sax.SAXException,
                  java.io.IOException
BEGIN SitemapComponent methods

isSkipping

protected boolean isSkipping()
END SitemapComponent methods

startElement

public void startElement(java.lang.String uri,
                         java.lang.String name,
                         java.lang.String raw,
                         org.xml.sax.Attributes attributes)
                  throws org.xml.sax.SAXException
BEGIN SAX ContentHandler handlers
Overrides:
startElement in class AbstractXMLPipe
Following copied from class: org.apache.cocoon.xml.AbstractXMLPipe
Parameters:
uri - The Namespace URI, or the empty string if the element has no Namespace URI or if Namespace processing is not being performed.
loc - The local name (without prefix), or the empty string if Namespace processing is not being performed.
raw - The raw XML 1.0 name (with prefix), or the empty string if raw names are not available.
a - The attributes attached to the element. If there are no attributes, it shall be an empty Attributes object.

endElement

public void endElement(java.lang.String uri,
                       java.lang.String name,
                       java.lang.String raw)
                throws org.xml.sax.SAXException
Description copied from class: AbstractXMLPipe
Receive notification of the end of an element.
Overrides:
endElement in class AbstractXMLPipe
Following copied from class: org.apache.cocoon.xml.AbstractXMLPipe
Parameters:
uri - The Namespace URI, or the empty string if the element has no Namespace URI or if Namespace processing is not being performed.
loc - The local name (without prefix), or the empty string if Namespace processing is not being performed.
raw - The raw XML 1.0 name (with prefix), or the empty string if raw names are not available.

characters

public void characters(char[] c,
                       int start,
                       int len)
                throws org.xml.sax.SAXException
Description copied from class: AbstractXMLPipe
Receive notification of character data.
Overrides:
characters in class AbstractXMLPipe
Following copied from class: org.apache.cocoon.xml.AbstractXMLPipe
Parameters:
c - The characters from the XML document.
start - The start position in the array.
len - The number of characters to read from the array.

processingInstruction

public void processingInstruction(java.lang.String target,
                                  java.lang.String data)
                           throws org.xml.sax.SAXException
Description copied from class: AbstractXMLPipe
Receive notification of a processing instruction.
Overrides:
processingInstruction in class AbstractXMLPipe
Following copied from class: org.apache.cocoon.xml.AbstractXMLPipe
Parameters:
target - The processing instruction target.
data - The processing instruction data, or null if none was supplied.

startEntity

public void startEntity(java.lang.String name)
                 throws org.xml.sax.SAXException
Description copied from class: AbstractXMLPipe
Report the beginning of an entity.
Overrides:
startEntity in class AbstractXMLPipe
Following copied from class: org.apache.cocoon.xml.AbstractXMLPipe
Parameters:
name - The name of the entity. If it is a parameter entity, the name will begin with '%'.

endEntity

public void endEntity(java.lang.String name)
               throws org.xml.sax.SAXException
Description copied from class: AbstractXMLPipe
Report the end of an entity.
Overrides:
endEntity in class AbstractXMLPipe
Following copied from class: org.apache.cocoon.xml.AbstractXMLPipe
Parameters:
name - The name of the entity that is ending.

startCDATA

public void startCDATA()
                throws org.xml.sax.SAXException
Description copied from class: AbstractXMLPipe
Report the start of a CDATA section.
Overrides:
startCDATA in class AbstractXMLPipe

endCDATA

public void endCDATA()
              throws org.xml.sax.SAXException
Description copied from class: AbstractXMLPipe
Report the end of a CDATA section.
Overrides:
endCDATA in class AbstractXMLPipe

comment

public void comment(char[] ch,
                    int start,
                    int len)
             throws org.xml.sax.SAXException
Description copied from class: AbstractXMLPipe
Report an XML comment anywhere in the document.
Overrides:
comment in class AbstractXMLPipe
Following copied from class: org.apache.cocoon.xml.AbstractXMLPipe
Parameters:
ch - An array holding the characters in the comment.
start - The starting position in the array.
len - The number of characters to use from the array.


Copyright © 1999-2001 Apache Software Foundation. All Rights Reserved.