## net.sf.saxon.event
Class ComplexContentOutputter

    java.lang.Object
      |
      +--net.sf.saxon.event.SequenceReceiver
            |
            +--net.sf.saxon.event.ComplexContentOutputter

All Implemented Interfaces:
  Receiver, javax.xml.transform.Result

public class ComplexContentOutputter
extends SequenceReceiver

This class is used for generating complex content, that is, the content of an element or document node. It enforces the rules on the order of events within complex content (attributes and namespaces must come first), and it implements part of the namespace fixup rules, in particular, it ensures that there is a namespace node for the namespace used in the element name and in each attribute name.

The same ComplexContentOutputter may be used for generating an entire XML document; it is not necessary to create a new outputter for each element node.

Field Summary

Fields inherited from class net.sf.saxon.event.SequenceReceiver
`locator, previousAtomic`

Fields inherited from interface javax.xml.transform.Result
`PI_DISABLE_OUTPUT_ESCAPING, PI_ENABLE_OUTPUT_ESCAPING`

Constructor Summary
`ComplexContentOutputter()`

Method Summary
`void` `append(Item item, int locationId)` Append an arbitrary item (node or atomic value) to the output
`void` `attribute(int nameCode, int typeCode, java.lang.CharSequence value, int locationId, int properties)` Output an attribute value.
`void` `characters(java.lang.CharSequence s, int locationId, int properties)` Produce text content output.
`void` `close()` Close the output
`void` `comment(java.lang.CharSequence comment, int locationId, int properties)` Write a comment
`void` `endDocument()` Notify the end of a document node
`void` `endElement()` Output an element end tag.
`Configuration` `getConfiguration()` Get the configuration
`java.lang.String` `getSystemId()`
`void` `namespace(int nscode, int properties)` Output a namespace declaration.
`void` `open()` Start the output process
`void` `processingInstruction(java.lang.String target, java.lang.CharSequence data, int locationId, int properties)` Write a processing instruction
`void` `setConfiguration(Configuration config)` Set the configuration
`void` `setReceiver(Receiver receiver)` Set the receiver (to handle the next stage in the pipeline) directly
`void` `setSystemId(java.lang.String systemId)` Set the System ID of the destination tree
`void` `startContent()` Flush out a pending start tag
`void` `startDocument(int properties)` Start of a document node.
`void` `startElement(int nameCode, int typeCode, int locationId, int properties)` Output an element start tag.

Methods inherited from class net.sf.saxon.event.SequenceReceiver
`getDocumentLocator, setDocumentLocator, setUnparsedEntity`

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

Constructor Detail

### ComplexContentOutputter

    public ComplexContentOutputter()

Method Detail

### setConfiguration

    public void setConfiguration(Configuration config)

  Description copied from interface: `Receiver`
  Set the configuration

### getConfiguration

    public Configuration getConfiguration()

  Description copied from interface: `Receiver`
  Get the configuration

### setSystemId

    public void setSystemId(java.lang.String systemId)

  Description copied from interface: `Receiver`
  Set the System ID of the destination tree

  Specified by:
    `setSystemId` in interface `Receiver`
  Overrides:
    `setSystemId` in class `SequenceReceiver`

### getSystemId

    public java.lang.String getSystemId()

  Specified by:
    `getSystemId` in interface `javax.xml.transform.Result`
  Overrides:
    `getSystemId` in class `SequenceReceiver`

### setReceiver

    public void setReceiver(Receiver receiver)

  Set the receiver (to handle the next stage in the pipeline) directly

### open

    public void open()
              throws XPathException

  Start the output process

  Specified by:
    `open` in interface `Receiver`
  Overrides:
    `open` in class `SequenceReceiver`
    `XPathException`

### startDocument

    public void startDocument(int properties)
                       throws XPathException

  Start of a document node. This event is ignored: we simply add the contained elements to the current document

    `XPathException`

### endDocument

    public void endDocument()
                     throws XPathException

  Notify the end of a document node

    `XPathException`

### characters

    public void characters(java.lang.CharSequence s,
                           int locationId,
                           int properties)
                    throws XPathException

  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
    `locationId` - an integer which can be interpreted using a LocationMap to return information such as line number and system ID. If no location information is available, the value zero is supplied.
    `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:
    `XPathException` - for any failure

### startElement

    public void startElement(int nameCode,
                             int typeCode,
                             int locationId,
                             int properties)
                      throws XPathException

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

  Parameters:
    `nameCode` - The element name code
    `typeCode` - integer code identifying the element's type within the name pool. The value -1 indicates the default type, xdt:untyped.
    `locationId` - an integer which can be interpreted using a LocationMap to return information such as line number and system ID. If no location information is available, the value zero is supplied.
    `XPathException`

### namespace

    public void namespace(int nscode,
                          int properties)
                   throws XPathException

  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:
    `XPathException` - 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 locationId,
                          int properties)
                   throws XPathException

  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:
    `nameCode` - The name of the attribute
    `value` - The value of the attribute
    `properties` - Bit fields containing properties of the attribute to be written
    `typeCode` - The type of the attribute, as held in the name pool
    `locationId` - an integer which can be interpreted using a LocationMap to return information such as line number and system ID. If no location information is available, the value zero is supplied.
  Throws:
    `XPathException` - 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.

### endElement

    public void endElement()
                    throws XPathException

  Output an element end tag.

    `XPathException`

### comment

    public void comment(java.lang.CharSequence comment,
                        int locationId,
                        int properties)
                 throws XPathException

  Write a comment

  Parameters:
    `comment` - The content of the comment
    `locationId` - an integer which can be interpreted using a LocationMap to return information such as line number and system ID. If no location information is available, the value zero is supplied.
    `properties` - Additional information about the comment. The following bits are defined:
  CHECKED
    Comment is known to be legal (e.g. doesn't contain "--")
    `XPathException`

### processingInstruction

    public void processingInstruction(java.lang.String target,
                                      java.lang.CharSequence data,
                                      int locationId,
                                      int properties)
                               throws XPathException

  Write a processing instruction

  Parameters:
    `target` - The PI name. This must be a legal name (it will not be checked).
    `data` - The data portion of the processing instruction
    `locationId` - an integer which can be interpreted using a LocationMap to return information such as line number and system ID. If no location information is available, the value zero is supplied.
    `properties` - Additional information about the PI. The following bits are defined:
  CHECKED
    Data is known to be legal (e.g. doesn't contain "?>")
    `XPathException`

### append

    public void append(Item item,
                       int locationId)
                throws XPathException

  Append an arbitrary item (node or atomic value) to the output

  Specified by:
    `append` in class `SequenceReceiver`
    `XPathException`

### close

    public void close()
               throws XPathException

  Close the output

    `XPathException`

### startContent

    public void startContent()
                      throws XPathException

  Flush out a pending start tag

    `XPathException`