org.apache.cocoon.components.language.markup
Class CocoonMarkupLanguage.PreProcessFilter

java.lang.Object
  extended by org.apache.avalon.framework.logger.AbstractLogEnabled
      extended by org.apache.cocoon.xml.AbstractXMLProducer
          extended by org.apache.cocoon.xml.AbstractXMLPipe
              extended by org.apache.cocoon.components.language.markup.CocoonMarkupLanguage.PreProcessFilter
All Implemented Interfaces:
Poolable, Recyclable, LogEnabled, XMLPipe, XMLProducer, XMLConsumer, ContentHandler, LexicalHandler
Direct Known Subclasses:
XSPMarkupLanguage.PreProcessFilter
Enclosing class:
CocoonMarkupLanguage

public class CocoonMarkupLanguage.PreProcessFilter
extends AbstractXMLPipe

Preprocess filter for Cocoon Markup languages. It looks for PI event other that <?xml-logisheet href="..."> for quoting them; It adds creation-date, file-name and file-path attributes to the root Element; And it quotes the PCDATA based by calling the quote method of the programming language.

See Also:
ContentHandler

Field Summary
protected  String filename
           
protected  AbstractXMLPipe filter
           
protected  boolean isRootElem
           
protected  ProgrammingLanguage language
           
protected  String localPrefix
           
protected  Logger log
           
 
Fields inherited from class org.apache.cocoon.xml.AbstractXMLProducer
contentHandler, EMPTY_CONTENT_HANDLER, lexicalHandler, xmlConsumer
 
Constructor Summary
CocoonMarkupLanguage.PreProcessFilter(AbstractXMLPipe filter, String filename, ProgrammingLanguage language)
           
 
Method Summary
 void enableLogging(Logger logger)
           
 void processingInstruction(String target, String data)
          Receive notification of a processing instruction.
 void setConsumer(XMLConsumer consumer)
          Set the XMLConsumer that will receive XML data.
 void setContentHandler(ContentHandler handler)
          Set the ContentHandler that will receive XML data.
 void setLexicalHandler(LexicalHandler handler)
          Set the LexicalHandler that will receive XML data.
 void startDocument()
          Receive notification of the beginning of a document.
 void startElement(String namespaceURI, String localName, String qName, Attributes atts)
          Receive notification of the beginning of an element.
 void startPrefixMapping(String prefix, String uri)
          Begin the scope of a prefix-URI Namespace mapping.
 
Methods inherited from class org.apache.cocoon.xml.AbstractXMLPipe
characters, comment, endCDATA, endDocument, endDTD, endElement, endEntity, endPrefixMapping, ignorableWhitespace, setDocumentLocator, skippedEntity, startCDATA, startDTD, startEntity
 
Methods inherited from class org.apache.cocoon.xml.AbstractXMLProducer
recycle
 
Methods inherited from class org.apache.avalon.framework.logger.AbstractLogEnabled
getLogger, setupLogger, setupLogger, setupLogger
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

protected Logger log

filter

protected AbstractXMLPipe filter

filename

protected String filename

isRootElem

protected boolean isRootElem

language

protected ProgrammingLanguage language

localPrefix

protected String localPrefix
Constructor Detail

CocoonMarkupLanguage.PreProcessFilter

public CocoonMarkupLanguage.PreProcessFilter(AbstractXMLPipe filter,
                                             String filename,
                                             ProgrammingLanguage language)
Parameters:
filename - the filename
language - the programming language
Method Detail

setConsumer

public void setConsumer(XMLConsumer consumer)
Description copied from class: AbstractXMLProducer
Set the XMLConsumer that will receive XML data.
This method will simply call setContentHandler(consumer) and setLexicalHandler(consumer).

Specified by:
setConsumer in interface XMLProducer
Overrides:
setConsumer in class AbstractXMLProducer

setContentHandler

public void setContentHandler(ContentHandler handler)
Description copied from class: AbstractXMLProducer
Set the ContentHandler that will receive XML data.
Subclasses may retrieve this ContentHandler instance accessing the protected super.contentHandler field.

Overrides:
setContentHandler in class AbstractXMLProducer

setLexicalHandler

public void setLexicalHandler(LexicalHandler handler)
Description copied from class: AbstractXMLProducer
Set the LexicalHandler that will receive XML data.
Subclasses may retrieve this LexicalHandler instance accessing the protected super.lexicalHandler field.

Overrides:
setLexicalHandler in class AbstractXMLProducer

enableLogging

public void enableLogging(Logger logger)
Specified by:
enableLogging in interface LogEnabled
Overrides:
enableLogging in class AbstractLogEnabled

startDocument

public void startDocument()
                   throws SAXException
Description copied from class: AbstractXMLPipe
Receive notification of the beginning of a document.

Specified by:
startDocument in interface ContentHandler
Overrides:
startDocument in class AbstractXMLPipe
Throws:
SAXException

processingInstruction

public void processingInstruction(String target,
                                  String data)
                           throws SAXException
Description copied from class: AbstractXMLPipe
Receive notification of a processing instruction.

Specified by:
processingInstruction in interface ContentHandler
Overrides:
processingInstruction in class AbstractXMLPipe
Parameters:
target - The processing instruction target.
data - The processing instruction data, or null if none was supplied.
Throws:
SAXException

startPrefixMapping

public void startPrefixMapping(String prefix,
                               String uri)
                        throws SAXException
Description copied from class: AbstractXMLPipe
Begin the scope of a prefix-URI Namespace mapping.

Specified by:
startPrefixMapping in interface ContentHandler
Overrides:
startPrefixMapping in class AbstractXMLPipe
Parameters:
prefix - The Namespace prefix being declared.
uri - The Namespace URI the prefix is mapped to.
Throws:
SAXException

startElement

public void startElement(String namespaceURI,
                         String localName,
                         String qName,
                         Attributes atts)
                  throws SAXException
Description copied from class: AbstractXMLPipe
Receive notification of the beginning of an element.

Specified by:
startElement in interface ContentHandler
Overrides:
startElement in class AbstractXMLPipe
Parameters:
namespaceURI - The Namespace URI, or the empty string if the element has no Namespace URI or if Namespace processing is not being performed.
localName - The local name (without prefix), or the empty string if Namespace processing is not being performed.
qName - The raw XML 1.0 name (with prefix), or the empty string if raw names are not available.
atts - The attributes attached to the element. If there are no attributes, it shall be an empty Attributes object.
Throws:
SAXException


Copyright © 1999-2010 The Apache Software Foundation. All Rights Reserved.