com.oroad.stxx.util
Class AbstractSAXTransformer

java.lang.Object
  extended bycom.oroad.stxx.util.AbstractSAXFilter
      extended bycom.oroad.stxx.util.AbstractSAXTransformer
All Implemented Interfaces:
org.xml.sax.ContentHandler, org.xml.sax.DTDHandler, org.xml.sax.ext.LexicalHandler, javax.xml.transform.sax.TransformerHandler, XMLConsumer
Direct Known Subclasses:
XMLFormFilter

public abstract class AbstractSAXTransformer
extends AbstractSAXFilter
implements javax.xml.transform.sax.TransformerHandler

Derived from Apache Cocoon: This class is the basis for all transformers. It provides various useful methods and hooks for implementing own custom transformers.

The basic behaviour of each transformer consists of the following four parts:

For all these four purposes the AbstractSAXTransformer offers some powerful methods and hooks:

Namespace handling

By setting the instance variable namespaceURI to the namespace the events are filtered and only events with this namespace are send to the two hooks startTransformingElement() and endTransformingElement().

It is possible to override the default namespace for the transformer by specifying the parameter "namespaceURI" in the pipeline. This avoids possible namespace collisions.

Recording of information

There are several methods for recording information, e.g. startRecording(), startTextRecording() etc. These methods collect information from the xml stream for further processing.

Creating new events

New events can be easily created with the sendEvents() method, the sendStartElementEvent() methods, the sendEndElementEvent() method or the sendTextEvent() method.

Initialization

Before the document is processed the setupTransforming() hook is invoked.

Version:
CVS $Id: AbstractSAXTransformer.java,v 1.2 2003/06/14 14:06:38 brentbaxter Exp $
Author:
Carsten Ziegeler

Field Summary
protected  java.lang.String systemID
          Description of the Field
protected  javax.xml.transform.Transformer transformer
          Description of the Field
 
Fields inherited from class com.oroad.stxx.util.AbstractSAXFilter
contentHandler, lexicalHandler
 
Constructor Summary
AbstractSAXTransformer()
           
 
Method Summary
 java.lang.String getSystemId()
          Gets the systemId attribute of the AbstractSAXTransformer object
 javax.xml.transform.Transformer getTransformer()
          Gets the transformer attribute of the AbstractSAXTransformer object
 void notationDecl(java.lang.String name, java.lang.String publicId, java.lang.String systemId)
          Description of the Method
 void setResult(javax.xml.transform.Result result)
          Sets the result attribute of the AbstractSAXTransformer object
 void setSystemId(java.lang.String newSystemID)
          Sets the systemId attribute of the AbstractSAXTransformer object
 void unparsedEntityDecl(java.lang.String name, java.lang.String publicId, java.lang.String systemId, java.lang.String notationName)
          Description of the Method
 
Methods inherited from class com.oroad.stxx.util.AbstractSAXFilter
characters, comment, endCDATA, endDocument, endDTD, endElement, endEntity, endPrefixMapping, ignorableWhitespace, processingInstruction, setContentHandler, setDocumentLocator, setLexicalHandler, skippedEntity, startCDATA, startDocument, startDTD, startElement, startEntity, startPrefixMapping
 
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
characters, endDocument, endElement, endPrefixMapping, ignorableWhitespace, processingInstruction, setDocumentLocator, skippedEntity, startDocument, startElement, startPrefixMapping
 
Methods inherited from interface org.xml.sax.ext.LexicalHandler
comment, endCDATA, endDTD, endEntity, startCDATA, startDTD, startEntity
 

Field Detail

systemID

protected java.lang.String systemID
Description of the Field


transformer

protected javax.xml.transform.Transformer transformer
Description of the Field

Constructor Detail

AbstractSAXTransformer

public AbstractSAXTransformer()
Method Detail

setResult

public void setResult(javax.xml.transform.Result result)
               throws java.lang.IllegalArgumentException
Sets the result attribute of the AbstractSAXTransformer object

Specified by:
setResult in interface javax.xml.transform.sax.TransformerHandler
Parameters:
result - The new result value
Throws:
java.lang.IllegalArgumentException - Description of the Exception

setSystemId

public void setSystemId(java.lang.String newSystemID)
Sets the systemId attribute of the AbstractSAXTransformer object

Specified by:
setSystemId in interface javax.xml.transform.sax.TransformerHandler
Parameters:
newSystemID - The new systemId value

getSystemId

public java.lang.String getSystemId()
Gets the systemId attribute of the AbstractSAXTransformer object

Specified by:
getSystemId in interface javax.xml.transform.sax.TransformerHandler
Returns:
The systemId value

getTransformer

public javax.xml.transform.Transformer getTransformer()
Gets the transformer attribute of the AbstractSAXTransformer object

Specified by:
getTransformer in interface javax.xml.transform.sax.TransformerHandler
Returns:
The transformer value

notationDecl

public void notationDecl(java.lang.String name,
                         java.lang.String publicId,
                         java.lang.String systemId)
                  throws org.xml.sax.SAXException
Description of the Method

Specified by:
notationDecl in interface org.xml.sax.DTDHandler
Parameters:
name - Description of the Parameter
publicId - Description of the Parameter
systemId - Description of the Parameter
Throws:
org.xml.sax.SAXException - Description of the Exception

unparsedEntityDecl

public void unparsedEntityDecl(java.lang.String name,
                               java.lang.String publicId,
                               java.lang.String systemId,
                               java.lang.String notationName)
                        throws org.xml.sax.SAXException
Description of the Method

Specified by:
unparsedEntityDecl in interface org.xml.sax.DTDHandler
Parameters:
name - Description of the Parameter
publicId - Description of the Parameter
systemId - Description of the Parameter
notationName - Description of the Parameter
Throws:
org.xml.sax.SAXException - Description of the Exception