|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.xml.sax.helpers.XMLFilterImpl | +--org.apache.xalan.transformer.TransformerImpl
**For advanced use only**
The Xalan workhorse -- Collaborates with the XPath xcontext, the DOM,
and the XPath engine, to transform a source tree of nodes into a result tree
according to instructions and templates specified by a stylesheet tree.
We suggest you use one of the
static XSLTProcessorFactory getProcessor() methods to instantiate the processor
and return an interface that greatly simplifies the process of manipulating
TransformerImpl.
The methods Please note that this class is not safe per instance over multiple
threads. If you are in a multithreaded environment, you should
keep a pool of these objects, or create a new one each time. In a
multithreaded environment, the right way to do things is to create a
StylesheetRoot via processStylesheet, and then reuse this object
over multiple threads. If you reuse the processor instance, you should call reset() between transformations.process(...)
are the primary public entry points.
The best way to perform transformations is to use the
XSLTProcessor#process(XSLTInputSource, XSLTInputSource, XSLTResultTarget)
method,
but you may use any of process methods defined in TransformerImpl.
XSLTProcessorFactory
,
XSLTProcessor
Field Summary | |
static boolean |
S_DEBUG
**For advanced use only** This is a compile-time flag to turn off calling of trace listeners. |
Constructor Summary | |
TransformerImpl(StylesheetRoot stylesheet)
**For advanced use only** Construct a TransformerImpl. |
Method Summary | |
ContentHandler |
createResultContentHandler(Result outputTarget)
**For advanced use only** Create a ContentHandler from a Result object. |
ContentHandler |
createResultContentHandler(Result outputTarget,
OutputFormat format)
**For advanced use only** Create a ContentHandler from a Result object. |
boolean |
currentTemplateRuleIsNull()
**For advanced use only** Tell if the current template rule is null. |
void |
executeChildTemplates(ElemTemplateElement elem,
Node sourceNode,
QName mode)
**For advanced use only** Execute each of the children of a template element. |
void |
executeChildTemplates(ElemTemplateElement elem,
Node sourceNode,
QName mode,
ContentHandler handler)
**For advanced use only** Execute each of the children of a template element. |
java.lang.String |
getBaseURLOfSource()
**For advanced use only** Get the base URL of the source. |
NodeIterator |
getContextNodeList()
**For advanced use only** Get the current context node list. |
CountersTable |
getCountersTable()
**For advanced use only** Get the table of counters, for optimized xsl:number support. |
ElemTemplateElement |
getCurrentElement()
**For advanced use only** Retrieves the stylesheet element that produced the SAX event. |
Node |
getCurrentNode()
**For advanced use only** This method retrieves the current context node in the source tree. |
ElemTemplate |
getCurrentTemplate()
**For advanced use only** This method retrieves the xsl:template that is in effect, which may be a matched template or a named template. |
java.lang.Exception |
getExceptionThrown()
**For advanced use only** |
boolean |
getFeature(java.lang.String name)
**For advanced use only** Look up the value of a feature. |
ContentHandler |
getInputContentHandler()
**For advanced use only** Get a SAX2 ContentHandler for the input. |
org.xml.sax.ext.DeclHandler |
getInputDeclHandler()
**For advanced use only** Get a SAX2 DeclHandler for the input. |
org.xml.sax.ext.LexicalHandler |
getInputLexicalHandler()
**For advanced use only** Get a SAX2 LexicalHandler for the input. |
KeyManager |
getKeyManager()
**For advanced use only** Get the KeyManager object. |
Node |
getMatchedNode()
**For advanced use only** Retrieves the node in the source tree that matched the template obtained via getMatchedTemplate(). |
ElemTemplate |
getMatchedTemplate()
**For advanced use only** This method retrieves the xsl:template that was matched. |
MsgMgr |
getMsgMgr()
**For advanced use only** Return the message manager. |
OutputFormat |
getOutputFormat()
**For advanced use only** Get the output properties used for the transformation. |
java.lang.Object |
getProperty(java.lang.String name)
**For advanced use only** Get the value of a property. |
boolean |
getQuietConflictWarnings()
**For advanced use only** Get quietConflictWarnings property. |
int |
getRecursionLimit()
**For advanced use only** Get the recursion limit. |
ResultTreeHandler |
getResultTreeHandler()
**For advanced use only** Get the ResultTreeHandler object. |
Serializer |
getSerializer()
**For advanced use only** |
StackGuard |
getStackGuard()
**For internal use only** Get the object used to guard the stack from recursion. |
ObjectPool |
getStringWriterPool()
**For internal use only** |
StylesheetRoot |
getStylesheet()
**For advanced use only** Get the current stylesheet for this processor. |
TraceManager |
getTraceManager()
**For advanced use only** Get an instance of the trace manager for this transformation. |
Transformer |
getTransformer()
**For advanced use only** Get the TrAX Transformer object in effect. |
java.lang.Thread |
getTransformThread()
**For internal use only** Get the thread that the transform process is on. |
XPathContext |
getXPathContext()
**For advanced use only** Get the XML Parser Liaison that this processor uses. |
boolean |
isParserEventsOnMain()
**For advanced use only** Get true if the parser events should be on the main thread, false if not. |
boolean |
isRecursiveAttrSet(ElemAttributeSet attrSet)
**For advanced use only** Check to see if this is a recursive attribute definition. |
boolean |
isTransformDone()
**For advanced use only** |
void |
parse(InputSource xmlSource)
**For advanced use only** Transform a document. |
Node |
parseToNode(InputSource xmlSource)
**For advanced use only** Process the an input source to a DOM node. |
void |
popCurrentTemplateRuleIsNull()
**For advanced use only** Push true if the current template rule is null, false otherwise. |
void |
popElemAttributeSet()
**For advanced use only** Pop the current executing attribute set. |
void |
popElemTemplateElement()
**For advanced use only** Pop the current template element. |
void |
pushCurrentTemplateRuleIsNull(boolean b)
**For advanced use only** Push true if the current template rule is null, false otherwise. |
void |
pushElemAttributeSet(ElemAttributeSet attrSet)
**For advanced use only** Push an executing attribute set, so we can check for recursive attribute definitions. |
void |
pushElemTemplateElement(ElemTemplateElement elem,
Node currentNode)
**For advanced use only** Push the current template element. |
void |
pushParams(Stylesheet stylesheetTree,
ElemTemplateElement xslCallTemplateElement,
Node sourceNode,
QName mode)
**For advanced use only** Given a template, search for the arguments and push them on the stack. |
void |
reset()
**For advanced use only** Reset the state. |
void |
resetParameters()
**For advanced use only** Reset the parameters to a null list. |
void |
run()
**For advanced use only** Run the transform thread. |
void |
setContentHandler(ContentHandler handler)
**For advanced use only** Allow an application to register a content event handler. |
void |
setEntityResolver(EntityResolver resolver)
**For advanced use only** |
void |
setOutputFormat(OutputFormat oformat)
**For advanced use only** Set the output properties for the transformation. |
void |
setParameter(java.lang.String name,
java.lang.String namespace,
java.lang.Object value)
**For advanced use only** Set a parameter for the templates. |
void |
setParent(XMLReader parent)
**For advanced use only** Set the parent reader. |
void |
setProperty(java.lang.String name,
java.lang.Object value)
**For advanced use only** Set the value of a property. |
void |
setQuietConflictWarnings(boolean b)
**For advanced use only** If the quietConflictWarnings property is set to true, warnings about pattern conflicts won't be printed to the diagnostics stream. |
void |
setRecursionLimit(int limit)
**For advanced use only** Get the recursion limit. |
void |
setSerializer(Serializer s)
**For advanced use only** |
void |
setSourceTreeDocForThread(Node doc)
**For advanced use only** This is just a way to set the document for run(). |
void |
setStylesheet(StylesheetRoot stylesheetRoot)
**For advanced use only** Set the stylesheet for this processor. |
void |
setTransformThread(java.lang.Thread t)
**For internal use only** Get the thread that the transform process is on. |
void |
setURIResolver(URIResolver resolver)
**For advanced use only** Set an object that will be used to resolve URIs used in document(), etc. |
void |
setXPathContext(XPathContext xcontext)
**For advanced use only** Set the execution context for XPath. |
void |
transform(InputSource xmlSource)
**For advanced use only** Process the source tree to SAX parse events. |
void |
transform(InputSource xmlSource,
Result outputTarget)
**For advanced use only** Process the source tree to the output result. |
boolean |
transformNode(ElemTemplateElement xslInstruction,
ElemTemplateElement template,
Node child,
QName mode)
**For advanced use only** Given an element and mode, find the corresponding template and process the contents. |
void |
transformNode(Node node)
**For advanced use only** Process the source node to the output result, if the processor supports the "http://xml.org/trax/features/dom/input" feature. |
void |
transformNode(Node node,
Result outputTarget)
**For advanced use only** Process the source node to the output result, if the processor supports the "http://xml.org/trax/features/dom/input" feature. |
void |
transformSelectedNodes(StylesheetComposed stylesheetTree,
ElemTemplateElement xslInstruction,
ElemTemplateElement template,
Node sourceNodeContext,
QName mode,
XPath selectPattern,
int selectStackFrameIndex)
**For advanced use only** Perform a query if needed, and call transformNode for each child. |
DocumentFragment |
transformToRTF(Stylesheet stylesheetTree,
ElemTemplateElement templateParent,
Node sourceNode,
QName mode)
**For advanced use only** Given a stylesheet element, create a result tree fragment from it's contents. |
java.lang.String |
transformToString(ElemTemplateElement elem,
Node sourceNode,
QName mode)
**For advanced use only** Take the contents of a template element, process it, and convert it to a string. |
Methods inherited from class org.xml.sax.helpers.XMLFilterImpl |
characters,
endDocument,
endElement,
endPrefixMapping,
error,
fatalError,
getContentHandler,
getDTDHandler,
getEntityResolver,
getErrorHandler,
getParent,
ignorableWhitespace,
notationDecl,
parse,
processingInstruction,
resolveEntity,
setDocumentLocator,
setDTDHandler,
setErrorHandler,
setFeature,
skippedEntity,
startDocument,
startElement,
startPrefixMapping,
unparsedEntityDecl,
warning |
Methods inherited from class java.lang.Object |
equals,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
Field Detail |
public static boolean S_DEBUG
Constructor Detail |
public TransformerImpl(StylesheetRoot stylesheet)
stylesheet
- The root of the stylesheet tree.Method Detail |
public void reset()
public void parse(InputSource xmlSource) throws SAXException, java.io.IOException
input
- The input source for the document entity.XMLReader.parse(org.xml.sax.InputSource)
public boolean isParserEventsOnMain()
public java.lang.Thread getTransformThread()
public void setTransformThread(java.lang.Thread t)
public void transform(InputSource xmlSource) throws TransformException
xmlSource
- The input for the source tree.public java.lang.String getBaseURLOfSource()
public java.lang.Object getProperty(java.lang.String name) throws SAXNotRecognizedException, SAXNotSupportedException
"http://xml.apache.org/xslt/sourcebase" - the base URL for the source, which is needed when pure SAX ContentHandler transformation is to be done.
name
- The property name, which is a fully-qualified URI.public void setProperty(java.lang.String name, java.lang.Object value) throws SAXNotRecognizedException, SAXNotSupportedException
"http://xml.apache.org/xslt/sourcebase" - the base URL for the source, which is needed when pure SAX ContentHandler transformation is to be done.
name
- The property name, which is a fully-qualified URI.value
- The requested value for the property.public Node parseToNode(InputSource xmlSource) throws TransformException
xmlSource
- The input for the source tree.public ContentHandler createResultContentHandler(Result outputTarget) throws TransformException
public ContentHandler createResultContentHandler(Result outputTarget, OutputFormat format) throws TransformException
public void transform(InputSource xmlSource, Result outputTarget) throws TransformException
xmlSource
- The input for the source tree.outputTarget
- The output source target.public void transformNode(Node node, Result outputTarget) throws TransformException
node
- The input source node, which can be any valid DOM node.outputTarget
- The output source target.public void transformNode(Node node) throws TransformException
node
- The input source node, which can be any valid DOM node.outputTarget
- The output source target.public ContentHandler getInputContentHandler()
public org.xml.sax.ext.DeclHandler getInputDeclHandler()
public org.xml.sax.ext.LexicalHandler getInputLexicalHandler()
public void setOutputFormat(OutputFormat oformat)
org.xml.org.apache.serialize.OutputFormat
public OutputFormat getOutputFormat()
org.xml.org.apache.serialize.OutputFormat
public Serializer getSerializer()
public void setSerializer(Serializer s)
public void setParameter(java.lang.String name, java.lang.String namespace, java.lang.Object value)
name
- The name of the parameter.namespace
- The namespace of the parameter.public void resetParameters()
public void pushParams(Stylesheet stylesheetTree, ElemTemplateElement xslCallTemplateElement, Node sourceNode, QName mode) throws SAXException
public void setURIResolver(URIResolver resolver)
resolver
- An object that implements the URIResolver interface,
or null.public void setEntityResolver(EntityResolver resolver)
public DocumentFragment transformToRTF(Stylesheet stylesheetTree, ElemTemplateElement templateParent, Node sourceNode, QName mode) throws SAXException
stylesheetTree
- The stylesheet object that holds the fragment.templateParent
- The template element that holds the fragment.sourceNode
- The current source context node.mode
- The mode under which the template is operating.public ObjectPool getStringWriterPool()
public java.lang.String transformToString(ElemTemplateElement elem, Node sourceNode, QName mode) throws SAXException
transformer
- The XSLT transformer instance.sourceNode
- The current source node context.mode
- The current mode.public void transformSelectedNodes(StylesheetComposed stylesheetTree, ElemTemplateElement xslInstruction, ElemTemplateElement template, Node sourceNodeContext, QName mode, XPath selectPattern, int selectStackFrameIndex) throws SAXException
stylesheetTree
- The owning stylesheet tree.xslInstruction
- The stylesheet element context (depricated -- I do
not think we need this).template
- The owning template context.sourceNodeContext
- The current source node context.mode
- The current mode.selectPattern
- The XPath with which to perform the selection.xslToken
- The current XSLT instruction (depricated -- I do not
think we want this).tcontext
- The TransformerImpl context.selectStackFrameIndex
- The stack frame context for executing the
select statement.public boolean transformNode(ElemTemplateElement xslInstruction, ElemTemplateElement template, Node child, QName mode) throws SAXException
stylesheetTree
- The current Stylesheet object.xslInstruction
- The calling element.template
- The template to use if xsl:for-each, or null.selectContext
- The selection context.child
- The source context node.mode
- The current mode, may be null.public void executeChildTemplates(ElemTemplateElement elem, Node sourceNode, QName mode, ContentHandler handler) throws SAXException
transformer
- The XSLT transformer instance.sourceNode
- The current context node.mode
- The current mode.public void executeChildTemplates(ElemTemplateElement elem, Node sourceNode, QName mode) throws SAXException
transformer
- The XSLT transformer instance.sourceNode
- The current context node.mode
- The current mode.public void pushElemTemplateElement(ElemTemplateElement elem, Node currentNode)
public void popElemTemplateElement()
public ElemTemplateElement getCurrentElement()
public Node getCurrentNode()
public ElemTemplate getCurrentTemplate()
Please note that the ElemTemplate returned may be a default template, and thus may not have a template defined in the stylesheet.
public ElemTemplate getMatchedTemplate()
public Node getMatchedNode()
public NodeIterator getContextNodeList()
public Transformer getTransformer()
public void setStylesheet(StylesheetRoot stylesheetRoot)
public StylesheetRoot getStylesheet()
public boolean getQuietConflictWarnings()
public void setQuietConflictWarnings(boolean b)
b
- true if conflict warnings should be suppressed.public void setXPathContext(XPathContext xcontext)
public XPathContext getXPathContext()
public StackGuard getStackGuard()
public int getRecursionLimit()
public void setRecursionLimit(int limit)
public ResultTreeHandler getResultTreeHandler()
public KeyManager getKeyManager()
public boolean isRecursiveAttrSet(ElemAttributeSet attrSet)
public void pushElemAttributeSet(ElemAttributeSet attrSet)
public void popElemAttributeSet()
public CountersTable getCountersTable()
public boolean currentTemplateRuleIsNull()
public void pushCurrentTemplateRuleIsNull(boolean b)
public void popCurrentTemplateRuleIsNull()
public MsgMgr getMsgMgr()
public TraceManager getTraceManager()
public void setParent(XMLReader parent)
This is the XMLReader from which this filter will obtain its events and to which it will pass its configuration requests. The parent may itself be another filter.
If there is no parent reader set, any attempt to parse or to set or get a feature or property will fail.
parent
- The parent XML reader.public void setContentHandler(ContentHandler handler)
If the application does not register a content handler, all content events reported by the SAX parser will be silently ignored.
Applications may register a new or different handler in the middle of a parse, and the SAX parser must begin using the new handler immediately.
handler
- The content handler.XMLFilterImpl.getContentHandler()
public boolean getFeature(java.lang.String name) throws SAXNotRecognizedException, SAXNotSupportedException
The feature name is any fully-qualified URI. It is possible for an Processor to recognize a feature name but to be unable to return its value; this is especially true in the case of an adapter for a SAX1 Parser, which has no way of knowing whether the underlying parser is validating, for example.
name
- The feature name, which is a fully-qualified
URI.public java.lang.Exception getExceptionThrown()
public void setSourceTreeDocForThread(Node doc)
public boolean isTransformDone()
public void run()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |