|
||||||||||
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
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 inherited from class java.applet.Applet |
java.applet.Applet.AccessibleApplet |
Nested classes inherited from class java.awt.Panel |
Panel.AccessibleAWTPanel |
Nested classes inherited from class java.awt.Container |
Container.AccessibleAWTContainer |
Nested classes inherited from class java.awt.Component |
Component.AccessibleAWTComponent, Component.BltBufferStrategy, Component.FlipBufferStrategy |
Field Summary | |
private String |
m_attrNameToSet
|
private String |
m_attrValueToSet
|
private Thread |
m_callThread
Thread stuff for the trusted worker thread. |
private URL |
m_codeBase
Save this for use on the worker thread; may not be necessary. |
private URL |
m_documentBase
DocumentBase URL |
private String |
m_documentURL
|
private String |
m_documentURLOfCached
|
private String |
m_elemIdToModify
|
(package private) String |
m_expression
Stylesheet parameter value |
private String |
m_htmlText
Where the worker thread puts the HTML text. |
(package private) String |
m_key
Stylesheet parameter key |
private String |
m_nameOfIDAttrOfElemToModify
Stylesheet attribute name and value that the caller can set. |
private String |
m_sourceText
Where the worker thread puts the document/stylesheet text. |
private String |
m_styleURL
|
private String |
m_styleURLOfCached
|
(package private) javax.xml.transform.TransformerFactory |
m_tfactory
The stylesheet processor. |
private String |
m_treeURL
|
private XSLTProcessorApplet.TrustedAgent |
m_trustedAgent
|
private Thread |
m_trustedWorker
Thread for running TrustedAgent. |
private String |
PARAM_documentURL
|
private String |
PARAM_styleURL
|
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. |
String |
escapeString(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. |
String |
getAppletInfo()
Get basic information about the applet |
String |
getHtmlText()
Assuming the stylesheet URL and the input XML URL have been set, perform the transformation and return the result as a String. |
String[][] |
getParameterInfo()
Get descriptions of the applet parameters. |
String |
getResultTreeAsText()
Get the HTML result Tree as a text string suitable for display in a browser. |
private String |
getSource()
Use a Transformer to copy the source document to a StreamResult. |
String |
getSourceTreeAsText()
Get the XML source Tree as a text string suitable for display in a browser. |
String |
getStyleTreeAsText()
Get the XSL style Tree as a text string suitable for display in a browser. |
String |
getTreeAsText(String treeURL)
Get an XML document (or stylesheet) |
void |
init()
Standard applet initialization. |
void |
paint(Graphics g)
Do not call; this applet contains no UI or visual components. |
private String |
processTransformation()
Process the transformation. |
void |
setDocumentURL(String urlString)
Set the URL to the XML document that will be transformed with the XSL stylesheet. |
void |
setStyleSheetAttribute(String nameOfIDAttrOfElemToModify,
String elemId,
String attrName,
String value)
Set an attribute in the stylesheet, which gives the ability to have some dynamic selection control. |
void |
setStylesheetParam(String key,
String expr)
Submit a stylesheet parameter. |
void |
setStyleURL(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. |
String |
transformToHtml(String doc)
Process a document and a stylesheet and return the transformation result. |
String |
transformToHtml(String doc,
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.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
javax.xml.transform.TransformerFactory m_tfactory
private String m_styleURL
private String m_documentURL
private final String PARAM_styleURL
private final String PARAM_documentURL
private String m_styleURLOfCached
private String m_documentURLOfCached
private URL m_codeBase
private String m_treeURL
private URL m_documentBase
private transient Thread m_callThread
private transient XSLTProcessorApplet.TrustedAgent m_trustedAgent
private transient Thread m_trustedWorker
private transient String m_htmlText
private transient String m_sourceText
private transient String m_nameOfIDAttrOfElemToModify
private transient String m_elemIdToModify
private transient String m_attrNameToSet
private transient String m_attrValueToSet
transient String m_key
transient String m_expression
Constructor Detail |
public XSLTProcessorApplet()
Method Detail |
public String getAppletInfo()
public String[][] getParameterInfo()
public void init()
public void start()
public void paint(Graphics g)
paint
in class Container
g
- the specified Graphics windowComponent.update(Graphics)
public void stop()
public void destroy()
public void setStyleURL(String urlString)
urlString
- valid URL string for XSL stylesheet.public void setDocumentURL(String urlString)
urlString
- valid URL string for XML document.public void freeCache()
public void setStyleSheetAttribute(String nameOfIDAttrOfElemToModify, String elemId, String attrName, 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(String key, String expr)
key
- stylesheet parameter keyexpr
- the parameter expression to be submitted.Transformer.setParameter(String,Object)
public String escapeString(String s)
s
- String to escape
The escaped string.public String getHtmlText()
public String getTreeAsText(String treeURL) throws IOException
treeURL
- valid URL string for the document.
IOException
private String getSource() throws javax.xml.transform.TransformerException
javax.xml.transform.TransformerException
public String getSourceTreeAsText() throws Exception
Exception
- thrown if tree can not be converted.public String getStyleTreeAsText() throws Exception
Exception
- thrown if tree can not be converted.public String getResultTreeAsText() throws Exception
Exception
- thrown if tree can not be converted.public String transformToHtml(String doc, String style)
doc
- URL string to XML documentstyle
- URL string to XSL stylesheet
public String transformToHtml(String doc)
doc
- URL string to XML document containing an xsl:stylesheet PI.
private String processTransformation() throws javax.xml.transform.TransformerException
javax.xml.transform.TransformerException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |