org.apache.cocoon.components.language.markup.xsp
Class XSPExpressionFilter

java.lang.Object
  extended by org.xml.sax.helpers.XMLFilterImpl
      extended by org.apache.cocoon.components.language.markup.LogicsheetFilter
          extended by org.apache.cocoon.components.language.markup.xsp.XSPExpressionFilter
All Implemented Interfaces:
XSPExpressionParser.Handler, ContentHandler, DTDHandler, EntityResolver, ErrorHandler, XMLFilter, XMLReader

public class XSPExpressionFilter
extends LogicsheetFilter
implements XSPExpressionParser.Handler

Filter attributes and text and expand {#expr} to xsp:attribute and xsp:expr elements.

Version:
$Id: XSPExpressionFilter.html 1304258 2012-03-23 10:09:27Z ilgrosso $

Nested Class Summary
static class XSPExpressionFilter.XMLPipeAdapter
           
 
Field Summary
 
Fields inherited from class org.apache.cocoon.components.language.markup.LogicsheetFilter
locator
 
Constructor Summary
XSPExpressionFilter(XSPMarkupLanguage markup)
           
 
Method Summary
protected  void addAttribute(AttributesImpl attribs, String name, String value)
          Add an attribute if it is neither null nor empty (length 0).
 void characters(char[] ch, int start, int length)
          Handle characters.
 void endElement(String uri, String loc, String raw)
          Flush the current expression.
 void handleExpression(char[] chars, int start, int length)
          Wrap expressions in xsp:expr tags.
 void handleText(char[] chars, int start, int length)
          Forward text to parent class.
 void startDocument()
          Create a new XSPExpressionFilter.
 void startElement(String namespaceURI, String localName, String qName, Attributes attribs)
          Start a new element.
 
Methods inherited from class org.apache.cocoon.components.language.markup.LogicsheetFilter
setDocumentLocator, setNamespaceMap, setParent, startPrefixMapping
 
Methods inherited from class org.xml.sax.helpers.XMLFilterImpl
endDocument, endPrefixMapping, error, fatalError, getContentHandler, getDTDHandler, getEntityResolver, getErrorHandler, getFeature, getParent, getProperty, ignorableWhitespace, notationDecl, parse, parse, processingInstruction, resolveEntity, setContentHandler, setDTDHandler, setEntityResolver, setErrorHandler, setFeature, setProperty, skippedEntity, unparsedEntityDecl, warning
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XSPExpressionFilter

public XSPExpressionFilter(XSPMarkupLanguage markup)
Method Detail

startDocument

public void startDocument()
                   throws SAXException
Create a new XSPExpressionFilter.

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

startElement

public void startElement(String namespaceURI,
                         String localName,
                         String qName,
                         Attributes attribs)
                  throws SAXException
Start a new element. If attribute value templates are enabled and the element has attributes with templates, these are replaced by xsp:attribute tags.

Specified by:
startElement in interface ContentHandler
Overrides:
startElement in class XMLFilterImpl
Throws:
SAXException
See Also:
ContentHandler.startElement(java.lang.String, java.lang.String, java.lang.String, org.xml.sax.Attributes)

endElement

public void endElement(String uri,
                       String loc,
                       String raw)
                throws SAXException
Flush the current expression.

Specified by:
endElement in interface ContentHandler
Overrides:
endElement in class XMLFilterImpl
Throws:
SAXException

characters

public void characters(char[] ch,
                       int start,
                       int length)
                throws SAXException
Handle characters. If text templates are enabled, the text is parsed and expressions are replaced.

Specified by:
characters in interface ContentHandler
Overrides:
characters in class XMLFilterImpl
Throws:
SAXException
See Also:
ContentHandler.characters(char[], int, int)

handleText

public void handleText(char[] chars,
                       int start,
                       int length)
                throws SAXException
Forward text to parent class.

Specified by:
handleText in interface XSPExpressionParser.Handler
Throws:
SAXException
See Also:
XSPExpressionParser.Handler.handleText(char[], int, int)

handleExpression

public void handleExpression(char[] chars,
                             int start,
                             int length)
                      throws SAXException
Wrap expressions in xsp:expr tags.

Specified by:
handleExpression in interface XSPExpressionParser.Handler
Throws:
SAXException
See Also:
XSPExpressionParser.Handler.handleExpression(char[], int, int)

addAttribute

protected void addAttribute(AttributesImpl attribs,
                            String name,
                            String value)
Add an attribute if it is neither null nor empty (length 0).

Parameters:
attribs - The attributes
name - The attribute name
value - The attribute value


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