org.apache.xalan.xsltc.runtime

Class AbstractTranslet

Implemented Interfaces:
Translet

public abstract class AbstractTranslet
extends java.lang.Object
implements Translet

Authors:
Jacek Ambroziak
Santiago Pericas-Geertsen
Morten Jorgensen
G. Todd Miller
John Howard, JohnH@schemasoft.com

Nested Class Summary

Field Summary

static int
CURRENT_TRANSLET_VERSION
static int
FIRST_TRANSLET_VERSION
static int
VER_SPLIT_NAMES_ARRAY
Vector
_cdata
String
_doctypePublic
String
_doctypeSystem
String
_encoding
Hashtable
_formatSymbols
Decimal number format symbol handling
boolean
_indent
String
_mediaType
String
_method
boolean
_omitHeader
String
_standalone
String
_version

Method Summary

void
addAuxiliaryClass(Class auxClass)
void
addCdataElement(String name)
Add's a name of an element whose text contents should be output as CDATA
void
addDecimalFormat(String name, DecimalFormatSymbols symbols)
Adds a DecimalFormat object to the _formatSymbols hashtable.
Object
addParameter(String name, Object value)
Add a new global parameter if not already in the current frame.
Object
addParameter(String name, Object value, boolean isDefault)
Add a new global or local parameter if not already in the current frame.
void
buildKeyIndex(String name, int node, Object value)
Adds a value to a key/id index
void
buildKeyIndex(String name, DOM dom)
Create an empty KeyIndex in the DOM case
void
buildKeys(DOM document, DTMAxisIterator iterator, SerializationHandler handler, int root)
This method builds key indexes - it is overridden in the compiled translet in cases where the element is used
void
characters(String string, SerializationHandler handler)
Used by some compiled code as a shortcut for passing strings to the output handler
void
clearParameters()
Clears the parameter stack.
void
closeOutputHandler(SerializationHandler handler)
KeyIndex
createKeyIndex()
Creates a KeyIndex object of the desired size - don't want to resize!
void
displayMessage(String msg)
Pass a message to the message handler - used by Message class.
Class
getAuxiliaryClass(String className)
DOMCache
getDOMCache()
Returns the DOM cache used for this translet.
DecimalFormat
getDecimalFormat(String name)
Retrieves a named DecimalFormat object from _formatSymbols hashtable.
KeyIndex
getKeyIndex(String name)
Returns the index for a given key (or id).
String[]
getNamesArray()
String[]
getNamespaceArray()
Object
getParameter(String name)
Get the value of a parameter from the current frame or null if undefined.
Templates
getTemplates()
int[]
getTypesArray()
String[]
getUrisArray()
boolean
hasIdCall()
DOMAdapter
makeDOMAdapter(DOM dom)
Wrap the initial input DOM in a dom adapter.
SerializationHandler
openOutputHandler(String filename)
SerializationHandler
openOutputHandler(String filename, boolean append)
Multiple output document extension.
void
popParamFrame()
Pop the topmost parameter frame.
void
postInitialization()
After constructing the translet object, this method must be called to perform any version-specific post-initialization that's required.
void
prepassDocument(DOM document)
Give the translet an opportunity to perform a prepass on the document to extract any information that it can store in an optimized form.
void
printInternalState()
Debugging
void
pushParamFrame()
Push a new parameter frame.
void
setAuxiliaryClasses(Hashtable auxClasses)
void
setDOMCache(DOMCache cache)
Sets the DOM cache used for additional documents loaded using the document() function.
void
setIndexSize(int size)
This method is used to pass the largest DOM size to the translet.
void
setKeyIndexDom(String name, DOM document)
This method builds key indexes - it is overridden in the compiled translet in cases where the element is used
void
setMessageHandler(MessageHandler handler)
Set the translet's message handler - must implement MessageHandler
void
setTemplates(Templates templates)
void
transform(DOM document, DTMAxisIterator iterator, SerializationHandler handler)
Main transform() method - this is overridden by the compiled translet
void
transform(DOM document, SerializationHandler handler)
Calls transform() with a given output handler

Field Details

CURRENT_TRANSLET_VERSION

public static final int CURRENT_TRANSLET_VERSION

Field Value:
101


FIRST_TRANSLET_VERSION

public static final int FIRST_TRANSLET_VERSION

Field Value:
100


VER_SPLIT_NAMES_ARRAY

public static final int VER_SPLIT_NAMES_ARRAY

Field Value:
101


_cdata

public Vector _cdata


_doctypePublic

public String _doctypePublic


_doctypeSystem

public String _doctypeSystem


_encoding

public String _encoding


_formatSymbols

public Hashtable _formatSymbols
Decimal number format symbol handling


_indent

public boolean _indent


_mediaType

public String _mediaType


_method

public String _method


_omitHeader

public boolean _omitHeader


_standalone

public String _standalone


_version

public String _version

Method Details

addAuxiliaryClass

public void addAuxiliaryClass(Class auxClass)
Specified by:
addAuxiliaryClass in interface Translet


addCdataElement

public void addCdataElement(String name)
Add's a name of an element whose text contents should be output as CDATA


addDecimalFormat

public void addDecimalFormat(String name,
                             DecimalFormatSymbols symbols)
Adds a DecimalFormat object to the _formatSymbols hashtable. The entry is created with the input DecimalFormatSymbols.


addParameter

public final Object addParameter(String name,
                                 Object value)
Add a new global parameter if not already in the current frame. To setParameters of the form {http://foo.bar}xyz This needs to get mapped to an instance variable in the class The mapping created so that the global variables in the generated class become http$colon$$flash$$flash$foo$dot$bar$colon$xyz
Specified by:
addParameter in interface Translet


addParameter

public final Object addParameter(String name,
                                 Object value,
                                 boolean isDefault)
Add a new global or local parameter if not already in the current frame. The 'isDefault' parameter is set to true if the value passed is the default value from the element's select attribute or element body.


buildKeyIndex

public void buildKeyIndex(String name,
                          int node,
                          Object value)
Adds a value to a key/id index


buildKeyIndex

public void buildKeyIndex(String name,
                          DOM dom)
Create an empty KeyIndex in the DOM case


buildKeys

public void buildKeys(DOM document,
                      DTMAxisIterator iterator,
                      SerializationHandler handler,
                      int root)
            throws TransletException
This method builds key indexes - it is overridden in the compiled translet in cases where the element is used
Specified by:
buildKeys in interface Translet


characters

public final void characters(String string,
                             SerializationHandler handler)
            throws TransletException
Used by some compiled code as a shortcut for passing strings to the output handler


clearParameters

public void clearParameters()
Clears the parameter stack.


closeOutputHandler

public void closeOutputHandler(SerializationHandler handler)


createKeyIndex

public KeyIndex createKeyIndex()
Creates a KeyIndex object of the desired size - don't want to resize!!!


displayMessage

public final void displayMessage(String msg)
Pass a message to the message handler - used by Message class.


getAuxiliaryClass

public Class getAuxiliaryClass(String className)
Specified by:
getAuxiliaryClass in interface Translet


getDOMCache

public DOMCache getDOMCache()
Returns the DOM cache used for this translet. Used by the LoadDocument class (if present) when the document() function is used.


getDecimalFormat

public final DecimalFormat getDecimalFormat(String name)
Retrieves a named DecimalFormat object from _formatSymbols hashtable.


getKeyIndex

public KeyIndex getKeyIndex(String name)
Returns the index for a given key (or id). The index implements our internal iterator interface


getNamesArray

public String[] getNamesArray()
Specified by:
getNamesArray in interface Translet


getNamespaceArray

public String[] getNamespaceArray()
Specified by:
getNamespaceArray in interface Translet


getParameter

public final Object getParameter(String name)
Get the value of a parameter from the current frame or null if undefined.


getTemplates

public Templates getTemplates()


getTypesArray

public int[] getTypesArray()
Specified by:
getTypesArray in interface Translet


getUrisArray

public String[] getUrisArray()
Specified by:
getUrisArray in interface Translet


hasIdCall

public boolean hasIdCall()


makeDOMAdapter

public final DOMAdapter makeDOMAdapter(DOM dom)
            throws TransletException
Wrap the initial input DOM in a dom adapter. This adapter is wrapped in a DOM multiplexer if the document() function is used (handled by compiled code in the translet - see compiler/Stylesheet.compileTransform()).


openOutputHandler

public SerializationHandler openOutputHandler(String filename)
            throws TransletException


openOutputHandler

public SerializationHandler openOutputHandler(String filename,
                                              boolean append)
            throws TransletException
Multiple output document extension. See compiler/TransletOutput for actual implementation.


popParamFrame

public final void popParamFrame()
Pop the topmost parameter frame.


postInitialization

public final void postInitialization()
After constructing the translet object, this method must be called to perform any version-specific post-initialization that's required.


prepassDocument

public final void prepassDocument(DOM document)
Give the translet an opportunity to perform a prepass on the document to extract any information that it can store in an optimized form. Currently, it only extracts information about attributes of type ID.


printInternalState

public void printInternalState()
Debugging


pushParamFrame

public final void pushParamFrame()
Push a new parameter frame.


setAuxiliaryClasses

public void setAuxiliaryClasses(Hashtable auxClasses)


setDOMCache

public void setDOMCache(DOMCache cache)
Sets the DOM cache used for additional documents loaded using the document() function.


setIndexSize

public void setIndexSize(int size)
This method is used to pass the largest DOM size to the translet. Needed to make sure that the translet can index the whole DOM.


setKeyIndexDom

public void setKeyIndexDom(String name,
                           DOM document)
This method builds key indexes - it is overridden in the compiled translet in cases where the element is used


setMessageHandler

public final void setMessageHandler(MessageHandler handler)
Set the translet's message handler - must implement MessageHandler


setTemplates

public void setTemplates(Templates templates)


transform

public void transform(DOM document,
                      DTMAxisIterator iterator,
                      SerializationHandler handler)
            throws TransletException
Main transform() method - this is overridden by the compiled translet
Specified by:
transform in interface Translet


transform

public final void transform(DOM document,
                            SerializationHandler handler)
            throws TransletException
Calls transform() with a given output handler
Specified by:
transform in interface Translet


Copyright B) 2004 Apache XML Project. All Rights Reserved.