org.apache.cocoon.transformation
Class JPathTransformer

java.lang.Object
  extended byorg.apache.cocoon.util.AbstractLogEnabled
      extended byorg.apache.cocoon.xml.AbstractXMLProducer
          extended byorg.apache.cocoon.xml.AbstractXMLPipe
              extended byorg.apache.cocoon.transformation.AbstractTransformer
                  extended byorg.apache.cocoon.transformation.AbstractSAXTransformer
                      extended byorg.apache.cocoon.transformation.JPathTransformer
All Implemented Interfaces:
Configurable, ContentHandler, Disposable, Initializable, LexicalHandler, Poolable, Recyclable, Serviceable, org.apache.cocoon.sitemap.SitemapModelComponent, org.apache.cocoon.transformation.Transformer, XMLConsumer, org.apache.cocoon.xml.XMLConsumer, org.apache.cocoon.xml.XMLPipe, org.apache.cocoon.xml.XMLProducer

public class JPathTransformer
extends org.apache.cocoon.transformation.AbstractSAXTransformer
implements Initializable

Transformer implementation of the JPath XSP tag library.

This transformer (so far) supports the following jpath elements:

Version:
$Id: JPathTransformer.html 1304280 2012-03-23 11:18:01Z ilgrosso $

Field Summary
static String JPATH_ACTION
          jpath:action attribute constant
static String JPATH_CONTINUATION
          jpath:continuation element constant
static String JPATH_CONTINUATION_SELECT
          jpath:continuation select attribute constant
static String JPATH_IF
          jpath:if element constant
static String JPATH_NAMESPACE_URI
          namespace constant
static String JPATH_TEST
          jpath generic test attribute
static String JPATH_VALUEOF
          jpath:value-of element constant
static String JPATH_VALUEOF_SELECT
          jpath:value-of select attribute constant
 
Fields inherited from class org.apache.cocoon.transformation.AbstractSAXTransformer
context, defaultNamespaceURI, EMPTY_ATTRIBUTES, ignoreEmptyCharacters, ignoreEventsCount, ignoreHooksCount, ignoreWhitespaces, manager, namespaceURI, objectModel, parameters, recorderStack, removeOurNamespacePrefixes, request, resolver, response, source, stack
 
Fields inherited from class org.apache.cocoon.xml.AbstractXMLProducer
contentHandler, EMPTY_CONTENT_HANDLER, lexicalHandler, xmlConsumer
 
Fields inherited from interface org.apache.cocoon.transformation.Transformer
ROLE
 
Constructor Summary
JPathTransformer()
          Constructor.
 
Method Summary
 void endTransformingElement(String uri, String name, String raw)
          Exit method for all elements in our namespace
 void initialize()
          Initialize this transformer.
 void recycle()
          Release all held resources.
 void setup(org.apache.cocoon.environment.SourceResolver resolver, Map objectModel, String src, Parameters parameters)
          Setup this transformer
 void startElement(String uri, String loc, String raw, Attributes a)
          Intercept startElement to ensure all <jpath:action> attributes are modified.
 void startTransformingElement(String uri, String name, String raw, Attributes attr)
          Entry method for all elements in our namespace
 
Methods inherited from class org.apache.cocoon.transformation.AbstractSAXTransformer
addRecorder, characters, comment, configure, dispose, endCDATA, endDocument, endDTD, endElement, endEntity, endParametersRecording, endParametersRecording, endPrefixMapping, endRecording, endSAXRecording, endSerializedXMLRecording, endTextRecording, findPrefixMapping, getMutableAttributes, ignorableWhitespace, processingInstruction, removeRecorder, sendEndElementEvent, sendEndElementEventNS, sendEndPrefixMapping, sendEvents, sendParametersEvents, sendStartElementEvent, sendStartElementEvent, sendStartElementEventNS, sendStartElementEventNS, sendStartPrefixMapping, sendTextEvent, service, setDocumentLocator, setupTransforming, skippedEntity, startCDATA, startDocument, startDTD, startEntity, startParametersRecording, startPrefixMapping, startRecording, startSAXRecording, startSerializedXMLRecording, startTextRecording
 
Methods inherited from class org.apache.cocoon.xml.AbstractXMLProducer
setConsumer, setContentHandler, setLexicalHandler
 
Methods inherited from class org.apache.cocoon.util.AbstractLogEnabled
getLogger, setLogger
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.apache.cocoon.xml.XMLProducer
setConsumer
 

Field Detail

JPATH_NAMESPACE_URI

public static final String JPATH_NAMESPACE_URI
namespace constant

See Also:
Constant Field Values

JPATH_ACTION

public static final String JPATH_ACTION
jpath:action attribute constant

See Also:
Constant Field Values

JPATH_VALUEOF

public static final String JPATH_VALUEOF
jpath:value-of element constant

See Also:
Constant Field Values

JPATH_VALUEOF_SELECT

public static final String JPATH_VALUEOF_SELECT
jpath:value-of select attribute constant

See Also:
Constant Field Values

JPATH_CONTINUATION

public static final String JPATH_CONTINUATION
jpath:continuation element constant

See Also:
Constant Field Values

JPATH_CONTINUATION_SELECT

public static final String JPATH_CONTINUATION_SELECT
jpath:continuation select attribute constant

See Also:
Constant Field Values

JPATH_IF

public static final String JPATH_IF
jpath:if element constant

See Also:
Constant Field Values

JPATH_TEST

public static final String JPATH_TEST
jpath generic test attribute

See Also:
Constant Field Values
Constructor Detail

JPathTransformer

public JPathTransformer()
Constructor. Set namespace.

Method Detail

initialize

public void initialize()
                throws Exception
Initialize this transformer.

Specified by:
initialize in interface Initializable
Throws:
Exception - if an error occurs

setup

public void setup(org.apache.cocoon.environment.SourceResolver resolver,
                  Map objectModel,
                  String src,
                  Parameters parameters)
           throws org.apache.cocoon.ProcessingException,
                  SAXException,
                  IOException
Setup this transformer

Specified by:
setup in interface org.apache.cocoon.sitemap.SitemapModelComponent
Parameters:
resolver - a SourceResolver instance
objectModel - the objectModel
src - src parameter
parameters - optional parameters
Throws:
org.apache.cocoon.ProcessingException - if an error occurs
SAXException - if an error occurs
IOException - if an error occurs

startElement

public void startElement(String uri,
                         String loc,
                         String raw,
                         Attributes a)
                  throws SAXException
Intercept startElement to ensure all <jpath:action> attributes are modified.

Specified by:
startElement in interface ContentHandler
Parameters:
uri - a String value
loc - a String value
raw - a String value
a - an Attributes value
Throws:
SAXException - if an error occurs

startTransformingElement

public void startTransformingElement(String uri,
                                     String name,
                                     String raw,
                                     Attributes attr)
                              throws org.apache.cocoon.ProcessingException,
                                     IOException,
                                     SAXException
Entry method for all elements in our namespace

Parameters:
uri - a String value
name - a String value
raw - a String value
attr - an Attributes value
Throws:
org.apache.cocoon.ProcessingException - if an error occurs
IOException - if an error occurs
SAXException - if an error occurs

endTransformingElement

public void endTransformingElement(String uri,
                                   String name,
                                   String raw)
                            throws org.apache.cocoon.ProcessingException,
                                   IOException,
                                   SAXException
Exit method for all elements in our namespace

Parameters:
uri - a String value
name - a String value
raw - a String value
Throws:
org.apache.cocoon.ProcessingException - if an error occurs
IOException - if an error occurs
SAXException - if an error occurs

recycle

public void recycle()
Release all held resources.

Specified by:
recycle in interface Recyclable


Copyright 1999-2008 The Apache Software Foundation. All Rights Reserved.