org.apache.xalan.xsltc.runtime
Class TextOutput

java.lang.Object
  |
  +--org.apache.xalan.xsltc.runtime.TextOutput

public final class TextOutput
extends java.lang.Object
implements TransletOutputHandler


Field Summary
static int HTML
           
static int QNAME
           
static int TEXT
           
static int UNKNOWN
           
static int XML
           
 
Constructor Summary
TextOutput(ContentHandler handler)
          Creates a new translet output post-processor
TextOutput(ContentHandler sax, LexicalHandler lex, java.lang.String encoding)
          Creates a new translet output post-processor
TextOutput(ContentHandler handler, java.lang.String encoding)
          Creates a new translet output post-processor
 
Method Summary
 void attribute(java.lang.String name, java.lang.String value)
          Put an attribute and its value in the start tag of an element.
 void characters(char[] ch, int off, int len)
          Send characters to the output document
 void close()
          Closes the output stream
 void closeStartTag()
          This method is called when all the data needed for a call to the SAX handler's startElement() method has been gathered.
 void comment(java.lang.String comment)
          Send a HTML-style comment to the output document
 void endDocument()
          Ends the document output.
 void endElement(java.lang.String elementName)
          End an element or CDATA section in the output document
 void namespace(java.lang.String prefix, java.lang.String uri)
          Send a namespace declaration in the output document.
 void omitHeader(boolean value)
          Directive to turn xml header declaration on/off.
 void processingInstruction(java.lang.String target, java.lang.String data)
          Send a processing instruction to the output document
 void setCdataElements(Hashtable elements)
          The instruction can specify that certain XML elements should be output as CDATA sections.
 void setDoctype(java.lang.String system, java.lang.String pub)
          Set the output document system/public identifiers
 boolean setEscaping(boolean escape)
          Turns special character escaping on/off.
 void setIndent(boolean indent)
          Turns output indentation on/off.
 void setMediaType(java.lang.String mediaType)
          Set the output media type - only relevant for HTML output
 void setStandalone(java.lang.String standalone)
          Set the XML standalone attribute - must be "yes" or "no"
 void setType(int type)
          Set the output type.
 void setVersion(java.lang.String version)
          Set the XML output document version - should be 1.0
 void startDocument()
          Starts the output document.
 void startElement(java.lang.String elementName)
          Start an element in the output document.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

UNKNOWN

public static final int UNKNOWN

XML

public static final int XML

HTML

public static final int HTML

TEXT

public static final int TEXT

QNAME

public static final int QNAME
Constructor Detail

TextOutput

public TextOutput(ContentHandler handler)
           throws java.io.IOException
Creates a new translet output post-processor
Parameters:
handler - A SAX2 handler to consume the generated SAX events
Throws:
java.io.IOException -  

TextOutput

public TextOutput(ContentHandler handler,
                  java.lang.String encoding)
           throws java.io.IOException
Creates a new translet output post-processor
Parameters:
handler - A SAX2 handler to consume the generated SAX events
encoding - The default encoding to use (set in )
Throws:
java.io.IOException -  

TextOutput

public TextOutput(ContentHandler sax,
                  LexicalHandler lex,
                  java.lang.String encoding)
           throws java.io.IOException
Creates a new translet output post-processor
Parameters:
handler - A SAX2 handler to consume the generated SAX events
encoding - The default encoding to use (set in )
Throws:
java.io.IOException -  
Method Detail

close

public void close()
Closes the output stream
Specified by:
close in interface TransletOutputHandler

closeStartTag

public void closeStartTag()
                   throws TransletException
This method is called when all the data needed for a call to the SAX handler's startElement() method has been gathered.

setEscaping

public boolean setEscaping(boolean escape)
                    throws TransletException
Turns special character escaping on/off. Note that characters will never, even if this option is set to 'true', be escaped within CDATA sections in output XML documents.
Specified by:
setEscaping in interface TransletOutputHandler

startDocument

public void startDocument()
                   throws TransletException
Starts the output document. Outputs the document header if the output type is set to XML.
Specified by:
startDocument in interface TransletOutputHandler

endDocument

public void endDocument()
                 throws TransletException
Ends the document output.
Specified by:
endDocument in interface TransletOutputHandler

characters

public void characters(char[] ch,
                       int off,
                       int len)
                throws TransletException
Send characters to the output document
Specified by:
characters in interface TransletOutputHandler

startElement

public void startElement(java.lang.String elementName)
                  throws TransletException
Start an element in the output document. This might be an XML element (data type) or a CDATA section.
Specified by:
startElement in interface TransletOutputHandler

attribute

public void attribute(java.lang.String name,
                      java.lang.String value)
               throws TransletException
Put an attribute and its value in the start tag of an element. Signal an exception if this is attempted done outside a start tag.
Specified by:
attribute in interface TransletOutputHandler

endElement

public void endElement(java.lang.String elementName)
                throws TransletException
End an element or CDATA section in the output document
Specified by:
endElement in interface TransletOutputHandler

comment

public void comment(java.lang.String comment)
             throws TransletException
Send a HTML-style comment to the output document
Specified by:
comment in interface TransletOutputHandler

processingInstruction

public void processingInstruction(java.lang.String target,
                                  java.lang.String data)
                           throws TransletException
Send a processing instruction to the output document
Specified by:
processingInstruction in interface TransletOutputHandler

namespace

public void namespace(java.lang.String prefix,
                      java.lang.String uri)
               throws TransletException
Send a namespace declaration in the output document. The namespace declaration will not be include if the namespace is already in scope with the same prefix.
Specified by:
namespace in interface TransletOutputHandler

setType

public void setType(int type)
Set the output type. The type must be wither TEXT, XML or HTML.
Specified by:
setType in interface TransletOutputHandler

setIndent

public void setIndent(boolean indent)
Turns output indentation on/off. Should only be set to on if the output type is XML or HTML.
Specified by:
setIndent in interface TransletOutputHandler

omitHeader

public void omitHeader(boolean value)
Directive to turn xml header declaration on/off.
Specified by:
omitHeader in interface TransletOutputHandler

setVersion

public void setVersion(java.lang.String version)
Set the XML output document version - should be 1.0

setStandalone

public void setStandalone(java.lang.String standalone)
Set the XML standalone attribute - must be "yes" or "no"

setDoctype

public void setDoctype(java.lang.String system,
                       java.lang.String pub)
Set the output document system/public identifiers

setMediaType

public void setMediaType(java.lang.String mediaType)
Set the output media type - only relevant for HTML output

setCdataElements

public void setCdataElements(Hashtable elements)
The instruction can specify that certain XML elements should be output as CDATA sections. This methods allows the translet to insert these elements into a hashtable of strings. Every output element is looked up in this hashtable before it is output.
Specified by:
setCdataElements in interface TransletOutputHandler


Copyright © 2001 Apache XML Project. All Rights Reserved.