net.sf.saxon.event
Class SimpleContentOutputter

java.lang.Object
  |
  +--net.sf.saxon.event.Outputter
        |
        +--net.sf.saxon.event.SimpleContentOutputter
All Implemented Interfaces:
Receiver, javax.xml.transform.Result, SequenceReceiver

public final class SimpleContentOutputter
extends Outputter

This class allows output to be generated. It channels output requests to an Emitter which does the actual writing. This implementation handles the rules for constructing simple content, which is used when processing the instructions xsl:attribute, xsl:comment, and xsl:processing-instruction.


Field Summary
 
Fields inherited from class net.sf.saxon.event.Outputter
previousAtomic
 
Fields inherited from interface javax.xml.transform.Result
PI_DISABLE_OUTPUT_ESCAPING, PI_ENABLE_OUTPUT_ESCAPING
 
Constructor Summary
SimpleContentOutputter(java.lang.StringBuffer buffer)
           
 
Method Summary
 void append(Item item)
          Append an arbitrary item (node or atomic value) to the output
 void attribute(int nameCode, int typeCode, java.lang.CharSequence value, int properties)
          Output an attribute value.
 void characters(java.lang.CharSequence s, int properties)
          Produce text content output.
 void comment(java.lang.CharSequence comment, int properties)
          Write a comment.
 void endDocument()
          Close the output
 void endElement()
          Output an element end tag.
 Configuration getConfiguration()
          Get the configuration
 void namespace(int nscode, int properties)
          Output a namespace declaration.
 void processingInstruction(java.lang.String target, java.lang.CharSequence data, int properties)
          Write a processing instruction No-op in this implementation
 void setConfiguration(Configuration config)
          Set the configuration
 void startContent()
          Notify the start of the content, that is, the completion of all attributes and namespaces.
 void startElement(int nameCode, int typeCode, int properties)
          Output an element start tag.
 
Methods inherited from class net.sf.saxon.event.Outputter
getSystemId, setDocumentLocator, setSystemId, setUnparsedEntity, startDocument
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SimpleContentOutputter

public SimpleContentOutputter(java.lang.StringBuffer buffer)
Method Detail

setConfiguration

public void setConfiguration(Configuration config)
Description copied from interface: Receiver
Set the configuration

Specified by:
setConfiguration in interface Receiver
Specified by:
setConfiguration in class Outputter

getConfiguration

public Configuration getConfiguration()
Description copied from interface: Receiver
Get the configuration

Specified by:
getConfiguration in interface Receiver
Specified by:
getConfiguration in class Outputter

characters

public void characters(java.lang.CharSequence s,
                       int properties)
                throws javax.xml.transform.TransformerException
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
properties - Bit significant value. The following bits are defined:
DISABLE_ESCAPING
Disable escaping for this text node
USE_CDATA
Output as a CDATA section
NO_SPECIAL_CHARACTERS
Value contains no special characters
WHITESPACE
Text is all whitespace
Throws:
javax.xml.transform.TransformerException - for any failure

startElement

public void startElement(int nameCode,
                         int typeCode,
                         int properties)
                  throws javax.xml.transform.TransformerException
Output an element start tag. With this outputter, this is a recoverable error.

Parameters:
nameCode - The element name code
typeCode - integer code identifying the element's type within the name pool.
javax.xml.transform.TransformerException

namespace

public void namespace(int nscode,
                      int properties)
               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.

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.

attribute

public void attribute(int nameCode,
                      int typeCode,
                      java.lang.CharSequence value,
                      int properties)
               throws javax.xml.transform.TransformerException
Output an attribute value.
No-op in this implementation.

Parameters:
nameCode - The name of the attribute
typeCode - The type annotation of the attribute
value - The value of the attribute
properties - Bits identifying properties of the attribute
Throws:
javax.xml.transform.TransformerException - if recoverable errors are to be treated as fatal. (Writing an attribute to this kind of destination is always an error)

startContent

public void startContent()
Description copied from interface: Receiver
Notify the start of the content, that is, the completion of all attributes and namespaces. Note that the initial receiver of output from XSLT instructions will not receive this event, it has to detect it itself. Note that this event is reported for every element even if it has no attributes, no namespaces, and no content.


endElement

public void endElement()
                throws javax.xml.transform.TransformerException
Output an element end tag.

javax.xml.transform.TransformerException

comment

public void comment(java.lang.CharSequence comment,
                    int properties)
             throws javax.xml.transform.TransformerException
Write a comment. No-op in this implementation

Parameters:
comment - The content of the comment
properties - Additional information about the comment. The following bits are defined:
CHECKED
Comment is known to be legal (e.g. doesn't contain "--")
javax.xml.transform.TransformerException

processingInstruction

public void processingInstruction(java.lang.String target,
                                  java.lang.CharSequence data,
                                  int properties)
                           throws javax.xml.transform.TransformerException
Write a processing instruction No-op in this implementation

Parameters:
target - The PI name. This must be a legal name (it will not be checked).
data - The data portion of the processing instruction
properties - Additional information about the PI. The following bits are defined:
CHECKED
Data is known to be legal (e.g. doesn't contain "?>")
javax.xml.transform.TransformerException

append

public void append(Item item)
            throws javax.xml.transform.TransformerException
Append an arbitrary item (node or atomic value) to the output

javax.xml.transform.TransformerException

endDocument

public void endDocument()
                 throws javax.xml.transform.TransformerException
Close the output

javax.xml.transform.TransformerException