com.icl.saxon.output
Class Outputter

java.lang.Object
  |
  +--com.icl.saxon.output.Outputter

public class Outputter
extends java.lang.Object

This class allows output to be generated. It channels output requests to an Emitter which does the actual writing.


Constructor Summary
Outputter()
           
 
Method Summary
 void close()
          Close the output
protected  void flushStartTag()
          Flush out a pending start tag
 Emitter getEmitter()
          Get emitter.
 OutputDetails getOutputDetails()
           
 void open()
          Start the output process
 void setEmitter(Emitter handler)
          Set the emitter that will deal with this output
 void setEscaping(boolean escaping)
          Switch escaping (of special characters) on or off.
 void setOutputDetails(OutputDetails details)
           
 void write(java.lang.String s)
           
 void writeAttribute(Name name, java.lang.String value)
          Output an attribute value.
 void writeAttribute(Name name, java.lang.String value, boolean noEscape)
          Output an attribute value.
 void writeComment(java.lang.String comment)
          Write a comment
 void writeContent(char[] chars, int start, int length)
          Produce text content output.
 void writeContent(java.lang.String s)
          Produce text content output.
 void writeContent(java.lang.StringBuffer chars, int start, int length)
          Produce text content output.
 void writeEndTag(Name name)
          Output an element end tag.
 void writeNamespaceDeclaration(java.lang.String prefix, java.lang.String uri, boolean substitute)
          Output a namespace declaration.
 void writePI(java.lang.String target, java.lang.String data)
          Write a processing instruction
 void writeStartTag(Name name)
          Output an element start tag.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Outputter

public Outputter()
Method Detail

setEmitter

public void setEmitter(Emitter handler)
Set the emitter that will deal with this output

getEmitter

public Emitter getEmitter()
                   throws org.xml.sax.SAXException
Get emitter. This is used by xsl:copy-of, a fragment is copied directly to the Emitter rather than going via the Outputter.

setOutputDetails

public void setOutputDetails(OutputDetails details)
                      throws org.xml.sax.SAXException

getOutputDetails

public OutputDetails getOutputDetails()

setEscaping

public void setEscaping(boolean escaping)
                 throws org.xml.sax.SAXException
Switch escaping (of special characters) on or off.
Parameters:
escaping: - true if special characters are to be escaped, false if not.

open

public void open()
          throws org.xml.sax.SAXException
Start the output process

write

public void write(java.lang.String s)
           throws org.xml.sax.SAXException

writeContent

public void writeContent(java.lang.String s)
                  throws org.xml.sax.SAXException
Produce text content output.
Special characters are escaped using XML/HTML conventions if the output format requires it.
Parameters:
s - The String to be output
Throws:
org.xml.sax.SAXException - for any failure

writeContent

public void writeContent(char[] chars,
                         int start,
                         int length)
                  throws org.xml.sax.SAXException
Produce text content output.
Special characters are escaped using XML/HTML conventions if the output format requires it.
Parameters:
chars - Character array to be output
start - start position of characters to be output
length - number of characters to be output
Throws:
org.xml.sax.SAXException - for any failure

writeContent

public void writeContent(java.lang.StringBuffer chars,
                         int start,
                         int length)
                  throws org.xml.sax.SAXException
Produce text content output.
Special characters are escaped using XML/HTML conventions if the output format requires it.
Parameters:
chars - StringBuffer containing to be output
start - start position of characters to be output
length - number of characters to be output
Throws:
org.xml.sax.SAXException - for any failure

writeStartTag

public void writeStartTag(Name name)
                   throws org.xml.sax.SAXException
Output an element start tag.
The actual output of the tag is deferred until all attributes have been output using writeAttribute().
Parameters:
name - The element name

writeNamespaceDeclaration

public void writeNamespaceDeclaration(java.lang.String prefix,
                                      java.lang.String uri,
                                      boolean substitute)
                               throws org.xml.sax.SAXException
Output a namespace declaration.
This is added to a list of pending namespaces for the current start tag. Note that unlike SAX2 startPrefixMapping(), this call is made AFTER writing the start tag.
Parameters:
prefix - The namespace prefix ("" for the default namespace)
uri - The namespace URI
substitute - If true, when a duplicate prefix is issued for a different URI, the prefix is replaced with a substitute prefix. If false, under these circumstances the declaration is ignored as a duplicate.
Throws:
org.xml.sax.SAXException - if there is no start tag to write to (created using writeStartTag), or if character content has been written since the start tag was written.

writeAttribute

public void writeAttribute(Name name,
                           java.lang.String value)
                    throws org.xml.sax.SAXException
Output an attribute value.
This is added to a list of pending attributes for the current start tag, overwriting any previous attribute with the same name.
This method should NOT be used to output namespace declarations.
Parameters:
name - The name of the attribute
value - The value of the attribute
Throws:
org.xml.sax.SAXException - if there is no start tag to write to (created using writeStartTag), or if character content has been written since the start tag was written.

writeAttribute

public void writeAttribute(Name name,
                           java.lang.String value,
                           boolean noEscape)
                    throws org.xml.sax.SAXException
Output an attribute value.
This is added to a list of pending attributes for the current start tag, overwriting any previous attribute with the same name.
This method should NOT be used to output namespace declarations.
Parameters:
name - The name of the attribute
value - The value of the attribute
noEscape - True if it's known there are no special characters in the value. If unsure, set this to false.
Throws:
org.xml.sax.SAXException - if there is no start tag to write to (created using writeStartTag), or if character content has been written since the start tag was written.

writeEndTag

public void writeEndTag(Name name)
                 throws org.xml.sax.SAXException
Output an element end tag.
Parameters:
name - The element name (tag)

writeComment

public void writeComment(java.lang.String comment)
                  throws org.xml.sax.SAXException
Write a comment

writePI

public void writePI(java.lang.String target,
                    java.lang.String data)
             throws org.xml.sax.SAXException
Write a processing instruction

close

public void close()
           throws org.xml.sax.SAXException
Close the output

flushStartTag

protected void flushStartTag()
                      throws org.xml.sax.SAXException
Flush out a pending start tag