Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.apache.xalan.xslt.client
Class XSLTProcessorApplet  view XSLTProcessorApplet download XSLTProcessorApplet.java

java.lang.Object
  extended byjava.awt.Component
      extended byjava.awt.Container
          extended byjava.awt.Panel
              extended byjava.applet.Applet
                  extended byorg.apache.xalan.xslt.client.XSLTProcessorApplet
All Implemented Interfaces:
javax.accessibility.Accessible, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable

public class XSLTProcessorApplet
extends java.applet.Applet

Provides applet host for the XSLT processor. To perform transformations on an HTML client:

  1. Use an <applet> tag to embed this applet in the HTML client.
  2. Use the DocumentURL and StyleURL PARAM tags or the setDocumentURL(java.lang.String) 55 and setStyleURL(java.lang.String) 55 methods to specify the XML source document and XSL stylesheet.
  3. Call the #transformToHTML method to perform the transformation and return the result as a String.


Nested Class Summary
(package private)  class XSLTProcessorApplet.TrustedAgent
          This class maintains a worker thread that that is trusted and can do things like access data.
 
Nested classes inherited from class java.applet.Applet
java.applet.Applet.AccessibleApplet
 
Nested classes inherited from class java.awt.Panel
java.awt.Panel.AccessibleAWTPanel
 
Nested classes inherited from class java.awt.Container
java.awt.Container.AccessibleAWTContainer
 
Nested classes inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
 
Field Summary
private  java.lang.String m_attrNameToSet
           
private  java.lang.String m_attrValueToSet
           
private  java.lang.Thread m_callThread
          Thread stuff for the trusted worker thread.
private  java.net.URL m_codeBase
          I save this for use on the worker thread, but i don't think I need to do this.
private  org.w3c.dom.Document m_docTree
           
private  java.net.URL m_documentBase
           
private  java.lang.String m_documentURL
           
private  java.lang.String m_documentURLOfCached
           
private  java.lang.String m_elemIdToModify
           
(package private)  java.lang.String m_expression
           
private  java.lang.String m_htmlText
          Where the worker thread puts the HTML text.
(package private)  java.lang.String m_key
           
(package private)  org.apache.xalan.xpath.xml.XMLParserLiaison m_liaison
          The XML Parser Liaison.
private  java.lang.String m_nameOfIDAttrOfElemToModify
          Stylesheet attribute name and value that the caller can set.
(package private)  org.apache.xalan.xslt.XSLTProcessor m_processor
           
private  org.w3c.dom.Document m_styleTree
           
private  java.lang.String m_styleURL
           
private  java.lang.String m_styleURLOfCached
           
private  XSLTProcessorApplet.TrustedAgent m_trustedAgent
           
private  java.lang.Thread m_trustedWorker
           
private  java.lang.String PARAM_documentURL
           
private  java.lang.String PARAM_parser
           
private  java.lang.String PARAM_styleURL
           
private  java.lang.String whichParser
           
 
Fields inherited from class java.applet.Applet
 
Fields inherited from class java.awt.Panel
 
Fields inherited from class java.awt.Container
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
XSLTProcessorApplet()
          The XSLTProcessorApplet constructor takes no arguments.
 
Method Summary
 void destroy()
          Cleanup; called when applet is terminated and unloaded.
private  java.lang.String doTransformation(org.apache.xalan.xpath.xml.XMLParserLiaison xmlProcessorLiaison, org.apache.xalan.xslt.XSLTProcessor processor)
          Do the real transformation after the right XML processor liason has been found.
 java.lang.String escapeString(java.lang.String s)
          Given a String containing markup, escape the markup so it can be displayed in the browser.
 void freeCache()
          The processor keeps a cache of the source and style trees, so call this method if they have changed or you want to do garbage collection.
 java.lang.String getAppletInfo()
          Get basic information about the applet
 java.lang.String getHtmlText()
          Assuming the stylesheet URL and the input XML URL have been set, perform the transformation and return the result as a String.
 java.lang.String[][] getParameterInfo()
          Get descriptions of the applet parameters.
 java.lang.String getResultTreeAsText()
          Get the HTML result Tree as a text string suitable for display in a browser.
 java.lang.String getSourceTreeAsText()
          Get the XML source Tree as a text string suitable for display in a browser.
 java.lang.String getStyleTreeAsText()
          Get the XSL style Tree as a text string suitable for display in a browser.
 java.lang.String getTreeAsText(java.lang.String treeURL)
          Get a DOM tree as escaped text, suitable for display in the browser.
 void init()
          Standard applet initialization.
protected  void initLiaison()
          Try to init the XML liaison object: currently not implemented.
 void paint(java.awt.Graphics g)
          Do not call; this applet contains no UI or visual components.
private  java.lang.String processTransformation()
          Process the transformation.
 void setDocumentURL(java.lang.String urlString)
          Set the URL to the XML document that will be transformed with the XSL stylesheet.
 void setStyleSheetAttribute(java.lang.String nameOfIDAttrOfElemToModify, java.lang.String elemId, java.lang.String attrName, java.lang.String value)
          Set an attribute in the stylesheet, which gives the ability to have some dynamic selection control.
 void setStylesheetParam(java.lang.String key, java.lang.String expr)
          Submit a stylesheet parameter.
 void setStyleURL(java.lang.String urlString)
          Set the URL to the XSL stylesheet that will be used to transform the input XML.
 void start()
          Automatically called when the HTML client containing the applet loads.
 void stop()
          Automatically called when the HTML page containing the applet is no longer on the screen.
 java.lang.String transformToHtml(java.lang.String doc)
          Process a document and a stylesheet and return the transformation result.
 java.lang.String transformToHtml(java.lang.String doc, java.lang.String style)
          Process a document and a stylesheet and return the transformation result.
 
Methods inherited from class java.applet.Applet
getAccessibleContext, getAppletContext, getAudioClip, getAudioClip, getCodeBase, getDocumentBase, getImage, getImage, getLocale, getParameter, isActive, newAudioClip, play, play, resize, resize, setStub, showStatus
 
Methods inherited from class java.awt.Panel
addNotify
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getInsets, getLayout, getListeners, getMaximumSize, getMinimumSize, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, paramString, preferredSize, print, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, removeNotify, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, setFont, setLayout, swapComponents, transferFocusDownCycle, update, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphics, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getToolkit, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isOpaque, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, reshape, setBackground, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, setVisible, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

m_liaison

transient org.apache.xalan.xpath.xml.XMLParserLiaison m_liaison
The XML Parser Liaison.


m_processor

org.apache.xalan.xslt.XSLTProcessor m_processor

m_styleURL

private java.lang.String m_styleURL

m_documentURL

private java.lang.String m_documentURL

PARAM_styleURL

private final java.lang.String PARAM_styleURL
See Also:
Constant Field Values

PARAM_documentURL

private final java.lang.String PARAM_documentURL
See Also:
Constant Field Values

PARAM_parser

private final java.lang.String PARAM_parser
See Also:
Constant Field Values

whichParser

private java.lang.String whichParser

m_styleURLOfCached

private java.lang.String m_styleURLOfCached

m_documentURLOfCached

private java.lang.String m_documentURLOfCached

m_codeBase

private java.net.URL m_codeBase
I save this for use on the worker thread, but i don't think I need to do this.


m_documentBase

private java.net.URL m_documentBase

m_docTree

private org.w3c.dom.Document m_docTree

m_styleTree

private org.w3c.dom.Document m_styleTree

m_callThread

private transient java.lang.Thread m_callThread
Thread stuff for the trusted worker thread.


m_trustedAgent

private transient XSLTProcessorApplet.TrustedAgent m_trustedAgent

m_trustedWorker

private transient java.lang.Thread m_trustedWorker

m_htmlText

private transient java.lang.String m_htmlText
Where the worker thread puts the HTML text.


m_nameOfIDAttrOfElemToModify

private transient java.lang.String m_nameOfIDAttrOfElemToModify
Stylesheet attribute name and value that the caller can set.


m_elemIdToModify

private transient java.lang.String m_elemIdToModify

m_attrNameToSet

private transient java.lang.String m_attrNameToSet

m_attrValueToSet

private transient java.lang.String m_attrValueToSet

m_key

transient java.lang.String m_key

m_expression

transient java.lang.String m_expression
Constructor Detail

XSLTProcessorApplet

public XSLTProcessorApplet()
The XSLTProcessorApplet constructor takes no arguments.

Method Detail

getAppletInfo

public java.lang.String getAppletInfo()
Get basic information about the applet


getParameterInfo

public java.lang.String[][] getParameterInfo()
Get descriptions of the applet parameters.


init

public void init()
Standard applet initialization.


initLiaison

protected void initLiaison()
Try to init the XML liaison object: currently not implemented.


destroy

public void destroy()
Cleanup; called when applet is terminated and unloaded.


paint

public void paint(java.awt.Graphics g)
Do not call; this applet contains no UI or visual components.


start

public void start()
Automatically called when the HTML client containing the applet loads. This method starts execution of the applet thread.


stop

public void stop()
Automatically called when the HTML page containing the applet is no longer on the screen. Stops execution of the applet thread.


setStyleURL

public void setStyleURL(java.lang.String urlString)
Set the URL to the XSL stylesheet that will be used to transform the input XML. No processing is done yet.


setDocumentURL

public void setDocumentURL(java.lang.String urlString)
Set the URL to the XML document that will be transformed with the XSL stylesheet. No processing is done yet.


freeCache

public void freeCache()
The processor keeps a cache of the source and style trees, so call this method if they have changed or you want to do garbage collection.


setStyleSheetAttribute

public void setStyleSheetAttribute(java.lang.String nameOfIDAttrOfElemToModify,
                                   java.lang.String elemId,
                                   java.lang.String attrName,
                                   java.lang.String value)
Set an attribute in the stylesheet, which gives the ability to have some dynamic selection control.


setStylesheetParam

public void setStylesheetParam(java.lang.String key,
                               java.lang.String expr)
Submit a stylesheet parameter.


escapeString

public java.lang.String escapeString(java.lang.String s)
Given a String containing markup, escape the markup so it can be displayed in the browser.


getHtmlText

public java.lang.String getHtmlText()
Assuming the stylesheet URL and the input XML URL have been set, perform the transformation and return the result as a String.


getTreeAsText

public java.lang.String getTreeAsText(java.lang.String treeURL)
                               throws java.io.IOException
Get a DOM tree as escaped text, suitable for display in the browser.


getSourceTreeAsText

public java.lang.String getSourceTreeAsText()
                                     throws java.lang.Exception
Get the XML source Tree as a text string suitable for display in a browser. Note that this is for display of the XML itself, not for rendering of HTML by the browser.


getStyleTreeAsText

public java.lang.String getStyleTreeAsText()
                                    throws java.lang.Exception
Get the XSL style Tree as a text string suitable for display in a browser. Note that this is for display of the XML itself, not for rendering of HTML by the browser.


getResultTreeAsText

public java.lang.String getResultTreeAsText()
                                     throws java.lang.Exception
Get the HTML result Tree as a text string suitable for display in a browser. Note that this is for display of the XML itself, not for rendering of HTML by the browser.


transformToHtml

public java.lang.String transformToHtml(java.lang.String doc,
                                        java.lang.String style)
Process a document and a stylesheet and return the transformation result. If one of these is null, the existing value (of a previous transformation) is not affected.


transformToHtml

public java.lang.String transformToHtml(java.lang.String doc)
Process a document and a stylesheet and return the transformation result. Use the xsl:stylesheet PI to find the document, if one exists.


doTransformation

private java.lang.String doTransformation(org.apache.xalan.xpath.xml.XMLParserLiaison xmlProcessorLiaison,
                                          org.apache.xalan.xslt.XSLTProcessor processor)
                                   throws org.apache.xalan.xslt.XSLProcessorException,
                                          java.net.MalformedURLException,
                                          java.io.FileNotFoundException,
                                          java.io.IOException,
                                          org.xml.sax.SAXException
Do the real transformation after the right XML processor liason has been found.


processTransformation

private java.lang.String processTransformation()
                                        throws org.apache.xalan.xslt.XSLProcessorException,
                                               java.net.MalformedURLException,
                                               java.io.IOException,
                                               java.io.FileNotFoundException,
                                               org.xml.sax.SAXException
Process the transformation.