org.apache.cocoon.sax
Class AbstractSAXTransformer

java.lang.Object
  extended by org.apache.cocoon.pipeline.component.AbstractPipelineComponent
      extended by org.apache.cocoon.sax.AbstractSAXPipelineComponent
          extended by org.apache.cocoon.sax.AbstractSAXProducer
              extended by org.apache.cocoon.sax.AbstractSAXTransformer
All Implemented Interfaces:
Consumer, PipelineComponent, Producer, SAXConsumer, SAXPipelineComponent, SAXProducer, ContentHandler, LexicalHandler
Direct Known Subclasses:
AbstractLinkRewriterTransformer, CleaningTransformer, I18nTransformer, IncludeTransformer, LogAsXMLTransformer, LogTransformer, SchemaProcessorTransformer, ServletServiceTransformer, SolrConsumer, SQLTransformer, StringTemplateTransformer, VariableExpanderTransformer, XIncludeTransformer, XSLTTransformer

public abstract class AbstractSAXTransformer
extends AbstractSAXProducer
implements SAXConsumer


Constructor Summary
AbstractSAXTransformer()
           
 
Method Summary
 void characters(char[] ch, int start, int length)
           
 void comment(char[] ch, int start, int length)
           
 void endCDATA()
           
 void endDocument()
           
 void endDTD()
           
 void endElement(String uri, String localName, String name)
           
 void endEntity(String name)
           
 void endPrefixMapping(String prefix)
           
 org.apache.cocoon.xml.sax.SAXBuffer endSAXRecording()
          Stop recording of SAX events.
 String endTextRecording()
          Stop recording of text and return the recorded information.
protected  String findPrefixMapping(String uri)
          Find prefix mapping for the given namespace URI.
 void ignorableWhitespace(char[] ch, int start, int length)
           
 void processingInstruction(String target, String data)
           
protected  ContentHandler removeRecorder()
          Remove a recorder.
protected  void sendEndPrefixMapping()
          Send all end prefix mapping events to the current content handler
protected  void sendStartPrefixMapping()
          Send all start prefix mapping events to the current content handler
 void setDocumentLocator(Locator locator)
           
protected  void setRecorder(ContentHandler recorder)
          Set a recorder.
 void skippedEntity(String name)
           
 void startCDATA()
           
 void startDocument()
           
 void startDTD(String name, String publicId, String systemId)
           
 void startElement(String uri, String localName, String name, Attributes atts)
           
 void startEntity(String name)
           
 void startPrefixMapping(String prefix, String uri)
           
 void startSAXRecording()
          Start recording of SAX events.
 void startTextRecording()
          Start recording of a text.
 
Methods inherited from class org.apache.cocoon.sax.AbstractSAXProducer
getSAXConsumer, setConsumer, setSAXConsumer, toString
 
Methods inherited from class org.apache.cocoon.pipeline.component.AbstractPipelineComponent
finish, setConfiguration, setup
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.apache.cocoon.pipeline.component.PipelineComponent
finish, setConfiguration, setup
 

Constructor Detail

AbstractSAXTransformer

public AbstractSAXTransformer()
Method Detail

characters

public void characters(char[] ch,
                       int start,
                       int length)
                throws SAXException
Specified by:
characters in interface ContentHandler
Throws:
SAXException

comment

public void comment(char[] ch,
                    int start,
                    int length)
             throws SAXException
Specified by:
comment in interface LexicalHandler
Throws:
SAXException

endCDATA

public void endCDATA()
              throws SAXException
Specified by:
endCDATA in interface LexicalHandler
Throws:
SAXException

endDocument

public void endDocument()
                 throws SAXException
Specified by:
endDocument in interface ContentHandler
Throws:
SAXException

endDTD

public void endDTD()
            throws SAXException
Specified by:
endDTD in interface LexicalHandler
Throws:
SAXException

endElement

public void endElement(String uri,
                       String localName,
                       String name)
                throws SAXException
Specified by:
endElement in interface ContentHandler
Throws:
SAXException

endEntity

public void endEntity(String name)
               throws SAXException
Specified by:
endEntity in interface LexicalHandler
Throws:
SAXException

endPrefixMapping

public void endPrefixMapping(String prefix)
                      throws SAXException
Specified by:
endPrefixMapping in interface ContentHandler
Throws:
SAXException

findPrefixMapping

protected String findPrefixMapping(String uri)
Find prefix mapping for the given namespace URI.

Returns:
Prefix mapping or null if no prefix defined

ignorableWhitespace

public void ignorableWhitespace(char[] ch,
                                int start,
                                int length)
                         throws SAXException
Specified by:
ignorableWhitespace in interface ContentHandler
Throws:
SAXException

processingInstruction

public void processingInstruction(String target,
                                  String data)
                           throws SAXException
Specified by:
processingInstruction in interface ContentHandler
Throws:
SAXException

setDocumentLocator

public void setDocumentLocator(Locator locator)
Specified by:
setDocumentLocator in interface ContentHandler

skippedEntity

public void skippedEntity(String name)
                   throws SAXException
Specified by:
skippedEntity in interface ContentHandler
Throws:
SAXException

startCDATA

public void startCDATA()
                throws SAXException
Specified by:
startCDATA in interface LexicalHandler
Throws:
SAXException

startDocument

public void startDocument()
                   throws SAXException
Specified by:
startDocument in interface ContentHandler
Throws:
SAXException

startDTD

public void startDTD(String name,
                     String publicId,
                     String systemId)
              throws SAXException
Specified by:
startDTD in interface LexicalHandler
Throws:
SAXException

startElement

public void startElement(String uri,
                         String localName,
                         String name,
                         Attributes atts)
                  throws SAXException
Specified by:
startElement in interface ContentHandler
Throws:
SAXException

startEntity

public void startEntity(String name)
                 throws SAXException
Specified by:
startEntity in interface LexicalHandler
Throws:
SAXException

startPrefixMapping

public void startPrefixMapping(String prefix,
                               String uri)
                        throws SAXException
Specified by:
startPrefixMapping in interface ContentHandler
Throws:
SAXException

setRecorder

protected void setRecorder(ContentHandler recorder)
Set a recorder. Do not invoke this method directly.

Parameters:
recorder -

removeRecorder

protected ContentHandler removeRecorder()
Remove a recorder. Do not invoke this method directly.


startSAXRecording

public void startSAXRecording()
                       throws SAXException
Start recording of SAX events. All incoming events are recorded and not forwarded. The resulting SAXBuffer can be obtained by the matching endSAXRecording() call.

Throws:
SAXException

endSAXRecording

public org.apache.cocoon.xml.sax.SAXBuffer endSAXRecording()
                                                    throws SAXException
Stop recording of SAX events. This method returns the resulting XMLizable.

Throws:
SAXException

sendStartPrefixMapping

protected void sendStartPrefixMapping()
                               throws SAXException
Send all start prefix mapping events to the current content handler

Throws:
SAXException

sendEndPrefixMapping

protected void sendEndPrefixMapping()
                             throws SAXException
Send all end prefix mapping events to the current content handler

Throws:
SAXException

startTextRecording

public void startTextRecording()
                        throws SAXException
Start recording of a text. No events forwarded, and all characters events are collected into a string.

Throws:
SAXException

endTextRecording

public String endTextRecording()
                        throws SAXException
Stop recording of text and return the recorded information.

Returns:
The String, trimmed.
Throws:
SAXException


Copyright © 2008-2012 The Apache Software Foundation. All Rights Reserved.