|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object java.awt.Component java.awt.Container java.awt.Panel java.applet.Applet org.apache.xalan.client.XSLTProcessorApplet
public class XSLTProcessorApplet
Provides applet host for the XSLT processor. To perform transformations on an HTML client:
setDocumentURL(java.lang.String)
and
setStyleURL(java.lang.String)
methods to specify the XML source document and XSL stylesheet.getHtmlText()
method (or one of the transformToHtml() methods)
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/interfaces inherited from class java.applet.Applet |
---|
java.applet.Applet.AccessibleApplet |
Nested classes/interfaces inherited from class java.awt.Panel |
---|
java.awt.Panel.AccessibleAWTPanel |
Nested classes/interfaces inherited from class java.awt.Container |
---|
java.awt.Container.AccessibleAWTContainer |
Nested classes/interfaces 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
Save this for use on the worker thread; may not be necessary. |
private java.net.URL |
m_documentBase
DocumentBase URL |
private java.lang.String |
m_documentURL
|
private java.lang.String |
m_documentURLOfCached
|
private java.lang.String |
m_elemIdToModify
|
private java.lang.String |
m_htmlText
Where the worker thread puts the HTML text. |
private java.lang.String |
m_nameOfIDAttrOfElemToModify
Stylesheet attribute name and value that the caller can set. |
(package private) java.util.Hashtable |
m_parameters
Stylesheet parameter key/value pair stored in a hashtable |
private java.lang.String |
m_sourceText
Where the worker thread puts the document/stylesheet text. |
private java.lang.String |
m_styleURL
|
private java.lang.String |
m_styleURLOfCached
|
(package private) javax.xml.transform.TransformerFactory |
m_tfactory
The stylesheet processor. |
private java.lang.String |
m_treeURL
|
private XSLTProcessorApplet.TrustedAgent |
m_trustedAgent
|
private java.lang.Thread |
m_trustedWorker
Thread for running TrustedAgent. |
private java.lang.String |
PARAM_documentURL
|
private java.lang.String |
PARAM_styleURL
|
private static long |
serialVersionUID
|
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. |
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. |
private java.lang.String |
getSource()
Use a Transformer to copy the source document to a StreamResult. |
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 an XML document (or stylesheet) |
void |
init()
Standard applet initialization. |
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. |
private void |
readObject(java.io.ObjectInputStream inStream)
|
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, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getInsets, getLayout, getListeners, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, paramString, preferredSize, print, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, removeNotify, setComponentZOrder, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, setLayout, transferFocusBackward, 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, firePropertyChange, firePropertyChange, firePropertyChange, 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, getMousePosition, 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, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isPreferredSizeSet, 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, setMaximumSize, setMinimumSize, setName, setPreferredSize, setSize, setSize, setVisible, show, show, size, toString, transferFocus, transferFocusUpCycle |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
transient javax.xml.transform.TransformerFactory m_tfactory
private java.lang.String m_styleURL
private java.lang.String m_documentURL
private final java.lang.String PARAM_styleURL
private final java.lang.String PARAM_documentURL
private java.lang.String m_styleURLOfCached
private java.lang.String m_documentURLOfCached
private java.net.URL m_codeBase
private java.lang.String m_treeURL
private java.net.URL m_documentBase
private transient java.lang.Thread m_callThread
private transient XSLTProcessorApplet.TrustedAgent m_trustedAgent
private transient java.lang.Thread m_trustedWorker
private transient java.lang.String m_htmlText
private transient java.lang.String m_sourceText
private transient java.lang.String m_nameOfIDAttrOfElemToModify
private transient java.lang.String m_elemIdToModify
private transient java.lang.String m_attrNameToSet
private transient java.lang.String m_attrValueToSet
transient java.util.Hashtable m_parameters
private static final long serialVersionUID
Constructor Detail |
---|
public XSLTProcessorApplet()
Method Detail |
---|
public java.lang.String getAppletInfo()
getAppletInfo
in class java.applet.Applet
public java.lang.String[][] getParameterInfo()
getParameterInfo
in class java.applet.Applet
public void init()
init
in class java.applet.Applet
public void start()
start
in class java.applet.Applet
public void paint(java.awt.Graphics g)
paint
in class java.awt.Container
public void stop()
stop
in class java.applet.Applet
public void destroy()
destroy
in class java.applet.Applet
public void setStyleURL(java.lang.String urlString)
urlString
- valid URL string for XSL stylesheet.public void setDocumentURL(java.lang.String urlString)
urlString
- valid URL string for XML document.public void freeCache()
public void setStyleSheetAttribute(java.lang.String nameOfIDAttrOfElemToModify, java.lang.String elemId, java.lang.String attrName, java.lang.String value)
nameOfIDAttrOfElemToModify
- The name of an attribute to search for a unique id.elemId
- The unique ID to look for.attrName
- Once the element is found, the name of the attribute to set.value
- The value to set the attribute to.public void setStylesheetParam(java.lang.String key, java.lang.String expr)
key
- stylesheet parameter keyexpr
- the parameter expression to be submitted.Transformer.setParameter(String,Object)
public java.lang.String escapeString(java.lang.String s)
s
- String to escape
The escaped string.public java.lang.String getHtmlText()
public java.lang.String getTreeAsText(java.lang.String treeURL) throws java.io.IOException
treeURL
- valid URL string for the document.
java.io.IOException
private java.lang.String getSource() throws javax.xml.transform.TransformerException
javax.xml.transform.TransformerException
public java.lang.String getSourceTreeAsText() throws java.lang.Exception
java.lang.Exception
- thrown if tree can not be converted.public java.lang.String getStyleTreeAsText() throws java.lang.Exception
java.lang.Exception
- thrown if tree can not be converted.public java.lang.String getResultTreeAsText() throws java.lang.Exception
java.lang.Exception
- thrown if tree can not be converted.public java.lang.String transformToHtml(java.lang.String doc, java.lang.String style)
doc
- URL string to XML documentstyle
- URL string to XSL stylesheet
public java.lang.String transformToHtml(java.lang.String doc)
doc
- URL string to XML document containing an xsl:stylesheet PI.
private java.lang.String processTransformation() throws javax.xml.transform.TransformerException
javax.xml.transform.TransformerException
private void readObject(java.io.ObjectInputStream inStream) throws java.io.IOException, java.lang.ClassNotFoundException
java.io.IOException
java.lang.ClassNotFoundException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |