Class AbstractTranslet

  • All Implemented Interfaces:
    Translet

    public abstract class AbstractTranslet
    extends java.lang.Object
    implements Translet
    Author:
    Jacek Ambroziak, Santiago Pericas-Geertsen, Morten Jorgensen, G. Todd Miller, John Howard, JohnH@schemasoft.com
    • Field Detail

      • _version

        public java.lang.String _version
      • _method

        public java.lang.String _method
      • _encoding

        public java.lang.String _encoding
      • _omitHeader

        public boolean _omitHeader
      • _standalone

        public java.lang.String _standalone
      • _doctypePublic

        public java.lang.String _doctypePublic
      • _doctypeSystem

        public java.lang.String _doctypeSystem
      • _indent

        public boolean _indent
      • _mediaType

        public java.lang.String _mediaType
      • _cdata

        public java.util.Vector _cdata
      • _indentamount

        public int _indentamount
      • CURRENT_TRANSLET_VERSION

        public static final int CURRENT_TRANSLET_VERSION
        See Also:
        Constant Field Values
      • _formatSymbols

        public Hashtable _formatSymbols
        Decimal number format symbol handling
    • Constructor Detail

      • AbstractTranslet

        public AbstractTranslet()
    • Method Detail

      • printInternalState

        public void printInternalState()
        Debugging
      • 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()).
        Throws:
        TransletException
      • pushParamFrame

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

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

        public final java.lang.Object addParameter​(java.lang.String name,
                                                   java.lang.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 java.lang.Object addParameter​(java.lang.String name,
                                                   java.lang.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.
      • clearParameters

        public void clearParameters()
        Clears the parameter stack.
      • getParameter

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

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

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

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

        public final java.text.DecimalFormat getDecimalFormat​(java.lang.String name)
        Retrieves a named DecimalFormat object from _formatSymbols hashtable.
      • 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.
      • 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.
      • 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.
      • createKeyIndex

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

        public void buildKeyIndex​(java.lang.String name,
                                  int node,
                                  java.lang.Object value)
        Adds a value to a key/id index
        Parameters:
        name - is the name of the index (the key or ##id)
        node - is the node handle of the node to insert
        value - is the value that will look up the node in the given index
      • buildKeyIndex

        public void buildKeyIndex​(java.lang.String name,
                                  DOM dom)
        Create an empty KeyIndex in the DOM case
        Parameters:
        name - is the name of the index (the key or ##id)
        dom - is the DOM
      • getKeyIndex

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

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

        public void setDOMCache​(DOMCache cache)
        Sets the DOM cache used for additional documents loaded using the document() function.
      • 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.
      • addCdataElement

        public void addCdataElement​(java.lang.String name)
        Add's a name of an element whose text contents should be output as CDATA
      • addAuxiliaryClass

        public void addAuxiliaryClass​(java.lang.Class auxClass)
        Specified by:
        addAuxiliaryClass in interface Translet
      • setAuxiliaryClasses

        public void setAuxiliaryClasses​(Hashtable auxClasses)
      • getAuxiliaryClass

        public java.lang.Class getAuxiliaryClass​(java.lang.String className)
        Specified by:
        getAuxiliaryClass in interface Translet
      • getNamesArray

        public java.lang.String[] getNamesArray()
        Specified by:
        getNamesArray in interface Translet
      • getUrisArray

        public java.lang.String[] getUrisArray()
        Specified by:
        getUrisArray in interface Translet
      • hasIdCall

        public boolean hasIdCall()
      • getTemplates

        public javax.xml.transform.Templates getTemplates()
      • setTemplates

        public void setTemplates​(javax.xml.transform.Templates templates)
      • newDocument

        public org.w3c.dom.Document newDocument​(java.lang.String uri,
                                                java.lang.String qname)
                                         throws javax.xml.parsers.ParserConfigurationException
        Throws:
        javax.xml.parsers.ParserConfigurationException