## com.icl.saxon.output
Class GeneralOutputter

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

public class GeneralOutputter
extends Outputter

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

Field Summary

Fields inherited from class com.icl.saxon.output.Outputter
`emitter`

Constructor Summary
`GeneralOutputter(NamePool pool)`

Method Summary
`int` `checkAttributePrefix(int nameCode)` Check that the prefix for an attribute is acceptable, returning a substitute prefix if not.
`void` `close()` Close the output
`void` `copyNamespaceNode(int nscode)` Copy a namespace node to the current element node (Rules defined in XSLT 1.0 errata)
`protected void` `flushStartTag()` Flush out a pending start tag
`java.util.Properties` `getOutputProperties()`
`Emitter` `makeEmitter(java.util.Properties props, javax.xml.transform.Result result)` Make an emitter appropriate for a given set of output properties and output destination.
`static java.io.FileOutputStream` `makeFileOutputStream(java.lang.String baseURI, java.lang.String fileName, boolean mkdirs)` Create a new FileOutputStream, given a filename and a baseURI
`void` `reset()` Synchronize the state of the Outputter with that of the underlying Emitter
`void` `setOutputDestination(java.util.Properties props, javax.xml.transform.Result result)` Initialise the outputter for a new output destination, supplying the output format details.
`boolean` `thereIsAnOpenStartTag()` Test whether there is an open start tag.
`static java.lang.String` `urlToFileName(java.lang.String base)` The following atrocious code is borrowed from Xalan, where it is commented simply: // yuck.
`void` `write(java.lang.String s)` Produce literal output.
`void` `writeAttribute(int nameCode, java.lang.String value)` Output an attribute value.
`void` `writeAttribute(int nameCode, 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 len)` Produce text content output.
`void` `writeEndTag(int nameCode)` Output an element end tag.
`void` `writeNamespaceDeclaration(int nscode)` Output a namespace declaration.
`void` `writePI(java.lang.String target, java.lang.String data)` Write a processing instruction
`void` `writeStartTag(int nameCode)` Output an element start tag.

Methods inherited from class com.icl.saxon.output.Outputter
`getEmitter, open, setEscaping`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### GeneralOutputter

    public GeneralOutputter(NamePool pool)

Method Detail

### setOutputDestination

    public void setOutputDestination(java.util.Properties props,
                                     javax.xml.transform.Result result)
                              throws javax.xml.transform.TransformerException

  Initialise the outputter for a new output destination, supplying the output format details.

  Parameters:
    `result` - Details of the new output destination
    `javax.xml.transform.TransformerException`

### urlToFileName

    public static java.lang.String urlToFileName(java.lang.String base)

  The following atrocious code is borrowed from Xalan, where it is commented simply: // yuck. The backslash variants added by MHK.

### makeFileOutputStream

    public static java.io.FileOutputStream makeFileOutputStream(java.lang.String baseURI,
                                                                java.lang.String fileName,
                                                                boolean mkdirs)
                                                         throws javax.xml.transform.TransformerException

  Create a new FileOutputStream, given a filename and a baseURI

    `javax.xml.transform.TransformerException`

### makeEmitter

    public Emitter makeEmitter(java.util.Properties props,
                               javax.xml.transform.Result result)
                        throws javax.xml.transform.TransformerException

  Make an emitter appropriate for a given set of output properties and output destination. Also updates the output properties

    `javax.xml.transform.TransformerException`

### reset

    public void reset()
               throws javax.xml.transform.TransformerException

  Description copied from class: `Outputter`
  Synchronize the state of the Outputter with that of the underlying Emitter

  Specified by:
    `reset` in class `Outputter`
    `javax.xml.transform.TransformerException`

### getOutputProperties

    public java.util.Properties getOutputProperties()

  Specified by:
    `getOutputProperties` in class `Outputter`

### write

    public void write(java.lang.String s)
               throws javax.xml.transform.TransformerException

  Description copied from class: `Outputter`
  Produce literal output. This is written as is, without any escaping. The method is provided for Java applications that wish to output literal HTML text. It is not used by the XSL system, which always writes using specific methods such as writeStartTag().

  Specified by:
    `write` in class `Outputter`
    `javax.xml.transform.TransformerException`

### writeContent

    public void writeContent(java.lang.String s)
                      throws javax.xml.transform.TransformerException

  Produce text content output.
  Special characters are escaped using XML/HTML conventions if the output format requires it.

  Specified by:
    `writeContent` in class `Outputter`
  Parameters:
    `s` - The String to be output
  Throws:
    `javax.xml.transform.TransformerException` - for any failure

### writeContent

    public void writeContent(char[] chars,
                             int start,
                             int length)
                      throws javax.xml.transform.TransformerException

  Produce text content output.
  Special characters are escaped using XML/HTML conventions if the output format requires it.

  Specified by:
    `writeContent` in class `Outputter`
  Parameters:
    `chars` - Character array to be output
    `start` - start position of characters to be output
    `length` - number of characters to be output
  Throws:
    `javax.xml.transform.TransformerException` - for any failure

### writeContent

    public void writeContent(java.lang.StringBuffer chars,
                             int start,
                             int len)
                      throws javax.xml.transform.TransformerException

  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
    `len` - number of characters to be output
  Throws:
    `javax.xml.transform.TransformerException` - for any failure

### writeStartTag

    public void writeStartTag(int nameCode)
                       throws javax.xml.transform.TransformerException

  Output an element start tag.
  The actual output of the tag is deferred until all attributes have been output using writeAttribute().

  Specified by:
    `writeStartTag` in class `Outputter`
  Parameters:
    `nameCode` - The element name code
    `javax.xml.transform.TransformerException`

### checkAttributePrefix

    public int checkAttributePrefix(int nameCode)
                             throws javax.xml.transform.TransformerException

  Check that the prefix for an attribute is acceptable, returning a substitute prefix if not. The prefix is acceptable unless a namespace declaration has been written that assignes this prefix to a different namespace URI. This method also checks that the attribute namespace has been declared, and declares it if not.

  Specified by:
    `checkAttributePrefix` in class `Outputter`
    `javax.xml.transform.TransformerException`

### writeNamespaceDeclaration

    public void writeNamespaceDeclaration(int nscode)
                                   throws javax.xml.transform.TransformerException

  Output a namespace declaration.
  This is added to a list of pending namespaces for the current start tag. If there is already another declaration of the same prefix, this one is ignored. Note that unlike SAX2 startPrefixMapping(), this call is made AFTER writing the start tag.

  Specified by:
    `writeNamespaceDeclaration` in class `Outputter`
  Parameters:
    `nscode` - The namespace code
  Throws:
    `javax.xml.transform.TransformerException` - 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.

### copyNamespaceNode

    public void copyNamespaceNode(int nscode)
                           throws javax.xml.transform.TransformerException

  Copy a namespace node to the current element node (Rules defined in XSLT 1.0 errata)

  Specified by:
    `copyNamespaceNode` in class `Outputter`
    `javax.xml.transform.TransformerException`

### thereIsAnOpenStartTag

    public boolean thereIsAnOpenStartTag()

  Test whether there is an open start tag. This determines whether it is possible to write an attribute node at this point.

  Specified by:
    `thereIsAnOpenStartTag` in class `Outputter`

### writeAttribute

    public void writeAttribute(int nameCode,
                               java.lang.String value)
                        throws javax.xml.transform.TransformerException

  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.

  Overrides:
    `writeAttribute` in class `Outputter`
  Parameters:
    `nameCode` - The name code of the attribute
    `value` - The value of the attribute
  Throws:
    `javax.xml.transform.TransformerException` - 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(int nameCode,
                               java.lang.String value,
                               boolean noEscape)
                        throws javax.xml.transform.TransformerException

  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.
  Before calling this, checkAttributePrefix() should be called to ensure the namespace is OK.

  Specified by:
    `writeAttribute` in class `Outputter`
  Parameters:
    `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:
    `javax.xml.transform.TransformerException` - 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(int nameCode)
                     throws javax.xml.transform.TransformerException

  Output an element end tag.

  Specified by:
    `writeEndTag` in class `Outputter`
  Parameters:
    `nameCode` - The element name code
    `javax.xml.transform.TransformerException`

### writeComment

    public void writeComment(java.lang.String comment)
                      throws javax.xml.transform.TransformerException

  Write a comment

  Specified by:
    `writeComment` in class `Outputter`
    `javax.xml.transform.TransformerException`

### writePI

    public void writePI(java.lang.String target,
                        java.lang.String data)
                 throws javax.xml.transform.TransformerException

  Write a processing instruction

  Specified by:
    `writePI` in class `Outputter`
    `javax.xml.transform.TransformerException`

### close

    public void close()
               throws javax.xml.transform.TransformerException

  Close the output

  Specified by:
    `close` in class `Outputter`
    `javax.xml.transform.TransformerException`

### flushStartTag

    protected void flushStartTag()
                          throws javax.xml.transform.TransformerException

  Flush out a pending start tag

    `javax.xml.transform.TransformerException`