org.apache.cocoon.transformation
Class NekoHTMLTransformer

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.NekoHTMLTransformer
All Implemented Interfaces:
Configurable, ContentHandler, Disposable, 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 NekoHTMLTransformer
extends org.apache.cocoon.transformation.AbstractSAXTransformer
implements Configurable

Converts (escaped) HTML snippets into tidied HTML using the NekoHTML library. This transformer expects a list of elements, passed as comma separated values of the "tags" parameter. It records the text enclosed in such elements and pass it thru Neko to obtain valid XHTML.

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

Nested Class Summary
static class NekoHTMLTransformer.HtmlSaxParser
           
 
Field Summary
 
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
NekoHTMLTransformer()
           
 
Method Summary
 void configure(Configuration config)
          Configure this transformer, possibly passing to it a jtidy configuration file location.
 void endElement(String uri, String name, String raw)
          React on endElement calls that contain a tag to be tidied and run Neko on it, otherwise passthru.
 void setup(org.apache.cocoon.environment.SourceResolver resolver, Map objectModel, String src, Parameters par)
          Setup this component, passing the tag names to be tidied.
 void startElement(String uri, String name, String raw, Attributes attr)
          Start buffering text if inside a tag to be normalized, passthru otherwise.
 
Methods inherited from class org.apache.cocoon.transformation.AbstractSAXTransformer
addRecorder, characters, comment, dispose, endCDATA, endDocument, endDTD, endEntity, endParametersRecording, endParametersRecording, endPrefixMapping, endRecording, endSAXRecording, endSerializedXMLRecording, endTextRecording, endTransformingElement, findPrefixMapping, getMutableAttributes, ignorableWhitespace, processingInstruction, recycle, 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, startTransformingElement
 
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
 

Constructor Detail

NekoHTMLTransformer

public NekoHTMLTransformer()
Method Detail

endElement

public void endElement(String uri,
                       String name,
                       String raw)
                throws SAXException
React on endElement calls that contain a tag to be tidied and run Neko on it, otherwise passthru.

Specified by:
endElement in interface ContentHandler
Throws:
SAXException
See Also:
ContentHandler.endElement(java.lang.String, java.lang.String, java.lang.String)

startElement

public void startElement(String uri,
                         String name,
                         String raw,
                         Attributes attr)
                  throws SAXException
Start buffering text if inside a tag to be normalized, passthru otherwise.

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

configure

public void configure(Configuration config)
               throws ConfigurationException
Configure this transformer, possibly passing to it a jtidy configuration file location.

Specified by:
configure in interface Configurable
Throws:
ConfigurationException

setup

public void setup(org.apache.cocoon.environment.SourceResolver resolver,
                  Map objectModel,
                  String src,
                  Parameters par)
           throws org.apache.cocoon.ProcessingException,
                  SAXException,
                  IOException
Setup this component, passing the tag names to be tidied.

Specified by:
setup in interface org.apache.cocoon.sitemap.SitemapModelComponent
Throws:
org.apache.cocoon.ProcessingException
SAXException
IOException


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