org.apache.cocoon.transformation
Class WriteDOMSessionTransformer

java.lang.Object
  extended byorg.apache.avalon.framework.logger.AbstractLogEnabled
      extended byorg.apache.cocoon.xml.AbstractXMLProducer
          extended byorg.apache.cocoon.xml.AbstractXMLPipe
              extended byorg.apache.cocoon.transformation.AbstractTransformer
                  extended byorg.apache.cocoon.transformation.WriteDOMSessionTransformer
All Implemented Interfaces:
ContentHandler, LexicalHandler, LogEnabled, Poolable, Recyclable, SitemapModelComponent, Transformer, XMLConsumer, XMLConsumer, XMLPipe, XMLProducer

public class WriteDOMSessionTransformer
extends AbstractTransformer

Version:
CVS $Id: WriteDOMSessionTransformer.java 109638 2004-12-03 06:54:28Z crossley $
Author:
Sven Beauprez
Cocoon.sitemap.component.documentation:
Make a DOM object from SAX events and write it to the session.
Cocoon.sitemap.component.logger:
sitemap.transformer.writeDOMsession Make a DOM object from SAX events and write it to the session. Usage in sitemap: <map:transform type="writeDOMsession"> <map:parameter name="dom-name" value="content"/> <map:parameter name="dom-root-element" value="companies"/> </map:transform> Where: dom-name is the name for the DOM object in the session dom-root-element is the trigger that will be the root element of the DOM
Cocoon.sitemap.component.name:
writeDOMsession

Field Summary
static String DOM_NAME
           
static String DOM_ROOT_ELEMENT
           
 
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
WriteDOMSessionTransformer()
           
 
Method Summary
 void characters(char[] c, int start, int len)
          Receive notification of character data.
 void endCDATA()
          Report the end of a CDATA section.
 void endElement(String uri, String name, String raw)
          Receive notification of the end of an element.
protected  void launchStoredMappings()
           
 void recycle()
          Recyclable
 void setup(SourceResolver resolver, Map objectModel, String source, Parameters parameters)
          BEGIN SitemapComponent methods
 void startCDATA()
          Report the start of a CDATA section.
 void startElement(String uri, String name, String raw, Attributes attributes)
          Receive notification of the beginning of an element.
 void startPrefixMapping(String prefix, String uri)
          BEGIN SAX ContentHandler handlers
protected  void storePrefixMapping(String prefix, String uri)
          END SAX ContentHandler handlers
 
Methods inherited from class org.apache.cocoon.xml.AbstractXMLPipe
comment, endDocument, endDTD, endEntity, endPrefixMapping, ignorableWhitespace, processingInstruction, setDocumentLocator, skippedEntity, startDocument, startDTD, startEntity
 
Methods inherited from class org.apache.cocoon.xml.AbstractXMLProducer
setConsumer, setContentHandler, setLexicalHandler
 
Methods inherited from class org.apache.avalon.framework.logger.AbstractLogEnabled
enableLogging, getLogger, setupLogger, setupLogger, setupLogger
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.xml.sax.ContentHandler
endDocument, endPrefixMapping, ignorableWhitespace, processingInstruction, setDocumentLocator, skippedEntity, startDocument
 
Methods inherited from interface org.xml.sax.ext.LexicalHandler
comment, endDTD, endEntity, startDTD, startEntity
 
Methods inherited from interface org.apache.cocoon.xml.XMLProducer
setConsumer
 

Field Detail

DOM_NAME

public static final String DOM_NAME
See Also:
Constant Field Values

DOM_ROOT_ELEMENT

public static final String DOM_ROOT_ELEMENT
See Also:
Constant Field Values
Constructor Detail

WriteDOMSessionTransformer

public WriteDOMSessionTransformer()
Method Detail

recycle

public void recycle()
Recyclable

Specified by:
recycle in interface Recyclable
Overrides:
recycle in class AbstractXMLProducer

setup

public void setup(SourceResolver resolver,
                  Map objectModel,
                  String source,
                  Parameters parameters)
           throws ProcessingException,
                  SAXException,
                  IOException
BEGIN SitemapComponent methods

Parameters:
resolver - The SourceResolver to find resources within your context.
objectModel - A java.util.Map that contains the request and session information.
source - The value of the "src" attribute in the sitemap.
parameters - The sitemap parameters passed into your component.
Throws:
ProcessingException - if there is any other unexpected problem.
IOException - if there is a problem reading files.
SAXException - if there is a problem reading a SAX stream.

startPrefixMapping

public void startPrefixMapping(String prefix,
                               String uri)
                        throws SAXException
BEGIN SAX ContentHandler handlers

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 uri,
                         String name,
                         String raw,
                         Attributes attributes)
                  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:
uri - The Namespace URI, or the empty string if the element has no Namespace URI or if Namespace processing is not being performed.
name - The local name (without prefix), or the empty string if Namespace processing is not being performed.
raw - The raw XML 1.0 name (with prefix), or the empty string if raw names are not available.
attributes - The attributes attached to the element. If there are no attributes, it shall be an empty Attributes object.
Throws:
SAXException

endElement

public void endElement(String uri,
                       String name,
                       String raw)
                throws SAXException
Description copied from class: AbstractXMLPipe
Receive notification of the end of an element.

Specified by:
endElement in interface ContentHandler
Overrides:
endElement in class AbstractXMLPipe
Parameters:
uri - The Namespace URI, or the empty string if the element has no Namespace URI or if Namespace processing is not being performed.
name - The local name (without prefix), or the empty string if Namespace processing is not being performed.
raw - The raw XML 1.0 name (with prefix), or the empty string if raw names are not available.
Throws:
SAXException

characters

public void characters(char[] c,
                       int start,
                       int len)
                throws SAXException
Description copied from class: AbstractXMLPipe
Receive notification of character data.

Specified by:
characters in interface ContentHandler
Overrides:
characters in class AbstractXMLPipe
Parameters:
c - The characters from the XML document.
start - The start position in the array.
len - The number of characters to read from the array.
Throws:
SAXException

startCDATA

public void startCDATA()
                throws SAXException
Description copied from class: AbstractXMLPipe
Report the start of a CDATA section.

Specified by:
startCDATA in interface LexicalHandler
Overrides:
startCDATA in class AbstractXMLPipe
Throws:
SAXException

endCDATA

public void endCDATA()
              throws SAXException
Description copied from class: AbstractXMLPipe
Report the end of a CDATA section.

Specified by:
endCDATA in interface LexicalHandler
Overrides:
endCDATA in class AbstractXMLPipe
Throws:
SAXException

storePrefixMapping

protected void storePrefixMapping(String prefix,
                                  String uri)
END SAX ContentHandler handlers


launchStoredMappings

protected void launchStoredMappings()
                             throws SAXException
Throws:
SAXException


Copyright ? 1999-2005 The Apache Software Foundation. All Rights Reserved.