org.apache.xalan.xslt
Class XSLTResultTarget

java.lang.Object
  |
  +--org.apache.xalan.xslt.XSLTResultTarget

public class XSLTResultTarget
extends java.lang.Object

Contains the result of a transformation that you perform with the XSLTProcessor process() method or one of the StylesheetRoot process() methods. Create an instance of this class to provide the process() method a container for the transformation result tree. You can use a file name or URL, character stream, byte stream, DOM Node, or SAX DocumentHandler to instantiate an XSLTResultTarget object.

See Also:
XSLTProcessor.process(XSLTInputSource, XSLTInputSource, XSLTResultTarget), StylesheetRoot

Constructor Summary
XSLTResultTarget()
          Zero-argument default constructor -- Before you can use the new XSLTResultTarget object in a transformation, you must define the output container by setting its FileName, CharacterStrea, ByteStream, or Node property.
XSLTResultTarget(org.xml.sax.DocumentHandler handler)
          Create a new output target with a SAX Document handler, which will handle result events -- the equivalent of creating an output target with the zero-argument constructor and setting the new object's DocyumentHandler property.
XSLTResultTarget(org.w3c.dom.Node n)
          Create a new output target with a DOM Node -- the equivalent of creating an output target with the zero-argument constructor and setting the new object's Node property.
XSLTResultTarget(java.io.OutputStream byteStream)
          Create a new output target with a byte stream -- the equivalent of creating an output target with the zero-argument constructor and setting the new object's ByteStream property.
XSLTResultTarget(java.lang.String fileName)
          Create a new output target with a file name -- the equivalent of creating an output target with the zero-argument constructor and setting the new object's FileName property.
XSLTResultTarget(java.io.Writer characterStream)
          Create a new output target with a character stream -- the equivalent of creating an output target with the zero-argument constructor and setting the new object's CharacterStream property.
 
Method Summary
 java.io.OutputStream getByteStream()
          Set the node that will contain the result DOM tree.
 java.io.Writer getCharacterStream()
          Set the system identifier for this Result.
 org.xml.sax.DocumentHandler getDocumentHandler()
          Get the SAX DocumentHandler that processes the result tree events.
 java.lang.String getEncoding()
          Get the character encoding that was used.
 java.lang.String getFileName()
          Set the file name or URL where the transformation result will be written.
 org.w3c.dom.Node getNode()
          Get the node that will contain the result DOM tree.
 javax.xml.transform.Result getResultObject()
          Get the Result object associated with this XSLTResultTarget object .
 void setDocumentHandler(org.xml.sax.DocumentHandler handler)
          Set a SAX DocumentHandler to process the result tree events.
 void setEncoding(java.lang.String encoding)
          Set the character encoding, if known.
 void setNode(org.w3c.dom.Node node)
          Set the node that will contain the result DOM tree.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XSLTResultTarget

public XSLTResultTarget()
Zero-argument default constructor -- Before you can use the new XSLTResultTarget object in a transformation, you must define the output container by setting its FileName, CharacterStrea, ByteStream, or Node property.
See Also:
setNode(Node), setDocumentHandler(DocumentHandler), setEncoding(String)

XSLTResultTarget

public XSLTResultTarget(java.lang.String fileName)
Create a new output target with a file name -- the equivalent of creating an output target with the zero-argument constructor and setting the new object's FileName property.
Parameters:
fileName - Identifies the file that will contain the transformation result (must be a valid system file name).
See Also:
setNode(Node), setDocumentHandler(DocumentHandler), setEncoding(String)

XSLTResultTarget

public XSLTResultTarget(java.io.OutputStream byteStream)
Create a new output target with a byte stream -- the equivalent of creating an output target with the zero-argument constructor and setting the new object's ByteStream property.
Parameters:
byteStream - The raw byte stream that will contain the transformation result.
See Also:
setNode(Node), setDocumentHandler(DocumentHandler), setEncoding(String)

XSLTResultTarget

public XSLTResultTarget(java.io.Writer characterStream)
Create a new output target with a character stream -- the equivalent of creating an output target with the zero-argument constructor and setting the new object's CharacterStream property.
Parameters:
characterStream - The character stream where the transformation result is written.
See Also:
setNode(Node), setDocumentHandler(DocumentHandler), setEncoding(String)

XSLTResultTarget

public XSLTResultTarget(org.w3c.dom.Node n)
Create a new output target with a DOM Node -- the equivalent of creating an output target with the zero-argument constructor and setting the new object's Node property.
Parameters:
node - The DOM Node that will contain the transformation result.
See Also:
setNode(Node), setDocumentHandler(DocumentHandler), setEncoding(String)

XSLTResultTarget

public XSLTResultTarget(org.xml.sax.DocumentHandler handler)
Create a new output target with a SAX Document handler, which will handle result events -- the equivalent of creating an output target with the zero-argument constructor and setting the new object's DocyumentHandler property.
Parameters:
handler - The SAX Document handler to which the result is written.
See Also:
setDocumentHandler(DocumentHandler), setNode(Node), setEncoding(String)
Method Detail

getFileName

public java.lang.String getFileName()
Set the file name or URL where the transformation result will be written.
Parameters:
fileName - The system identifier as a string.
Returns:
The file name or URL.
See Also:
public void setFileName (String fileName) // File? { this.fileName = fileName; } /** Get the file name where the results are or will be written, or null if none was supplied., XSLTResultTarget(String)

setEncoding

public void setEncoding(java.lang.String encoding)
Set the character encoding, if known.
Parameters:
encoding - The character encoding.

getEncoding

public java.lang.String getEncoding()
Get the character encoding that was used.
Returns:
The encoding, or null if none was supplied.

setDocumentHandler

public void setDocumentHandler(org.xml.sax.DocumentHandler handler)
Set a SAX DocumentHandler to process the result tree events. You can process events as they occur rather than waiting for the transformation to be completed.
Parameters:
handler - The SAX DocumentHandler to process result tree events.
See Also:
XSLTResultTarget(DocumentHandler), getDocumentHandler()

getDocumentHandler

public org.xml.sax.DocumentHandler getDocumentHandler()
Get the SAX DocumentHandler that processes the result tree events. You can use the DocumentHandler to process events as they occur rather than waiting for the transformation to be completed.
Returns:
The SAX DocumentHandler that processes result tree events.
See Also:
XSLTResultTarget(DocumentHandler), setDocumentHandler(DocumentHandler)

setNode

public void setNode(org.w3c.dom.Node node)
Set the node that will contain the result DOM tree. In practice, the node should be a Document node, a DocumentFragment node, or a Element node. In other words, a node that accepts children.
Parameters:
node - The node to which the transformation will be appended.

getNode

public org.w3c.dom.Node getNode()
Get the node that will contain the result DOM tree. If no node was set via setNode, the node will be set by the transformation, and may be obtained from this method once the transformation is complete.
Returns:
The node to which the transformation will be appended.

getByteStream

public java.io.OutputStream getByteStream()
Set the node that will contain the result DOM tree. In practice, the node should be a Document node, a DocumentFragment node, or a Element node. In other words, a node that accepts children.
Parameters:
node - The node to which the transformation will be appended. public void setByteStream(OutputStream byteStrm) { this.byteStream = byteStrm; } /** Get the node that will contain the result DOM tree. If no node was set via setNode, the node will be set by the transformation, and may be obtained from this method once the transformation is complete.
Returns:
The node to which the transformation will be appended.

getCharacterStream

public java.io.Writer getCharacterStream()
Set the system identifier for this Result.

If the Result is not to be written to a file, the system identifier is optional. The application may still want to provide one, however, for use in error messages and warnings, or to resolve relative output identifiers.

Parameters:
systemId - The system identifier as a URI string. public void setSystemId(String systemID) { systemId = systemID; } /** Get the system identifier that was set with setSystemId.
writer - A valid Writer reference. public void setWriter(Writer writer) { this.characterStream = writer; } /** Get the character stream that was set with setWriter.
Returns:
The system identifier that was set with setSystemId, or null if setSystemId was not called. public String getSystemId() { return systemId; } /** Set the writer that is to receive the result. Normally, a stream should be used rather than a writer, so that the transformer may use instructions contained in the transformation instructions to control the encoding. However, there are times when it is useful to write to a writer, such as when using a StringWriter.

getResultObject

public javax.xml.transform.Result getResultObject()
Get the Result object associated with this XSLTResultTarget object .
Returns:
The Result object associated with this XSLTResultTarget object


Copyright © 2000 Apache XML Project. All Rights Reserved.