Package net.sf.saxon.event

## Class SequenceReceiver

- java.lang.Object
- - net.sf.saxon.event.SequenceReceiver

- All Implemented Interfaces:
    `javax.xml.transform.Result`, `Receiver`
  Direct Known Subclasses:
    `Emitter`, `EventBuffer`, `ProxyReceiver`, `SequenceWrapper`, `SequenceWriter`, `Sink`, `TeeOutputter`, `TreeReceiver`, `WatchManager`

      public abstract class SequenceReceiver
      extends java.lang.Object
      implements Receiver

  SequenceReceiver: this extension of the Receiver interface is used when processing a sequence constructor. It differs from the Receiver in allowing items (atomic values or nodes) to be added to the sequence, not just tree-building events.

- - ### Field Summary

    Fields
    Modifier and Type | Field | Description
    --- | --- | ---
    `protected PipelineConfiguration` | `pipelineConfiguration` |
    `protected boolean` | `previousAtomic` |
    `protected java.lang.String` | `systemId` |

    - ### Fields inherited from interface javax.xml.transform.Result

      `PI_DISABLE_OUTPUT_ESCAPING, PI_ENABLE_OUTPUT_ESCAPING`

  - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `SequenceReceiver​(PipelineConfiguration pipe)` | Create a SequenceReceiver

  - ### Method Summary

    All Methods Instance Methods Abstract Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `void` | `append​(Item item)` | Append an arbitrary item (node, atomic value, or function) to the output.
    `abstract void` | `append​(Item item, Location locationId, int properties)` | Append an arbitrary item (node, atomic value, or function) to the output
    `protected void` | `decompose​(Item item, Location locationId, int copyNamespaces)` | Helper method for subclasses to invoke if required: decompose an item into a sequence of node events.
    `protected void` | `flatten​(ArrayItem array, Location locationId, int copyNamespaces)` | Helper method for subclasses to invoke if required: flatten an array.
    `Configuration` | `getConfiguration()` | Get the Saxon Configuration
    `protected java.lang.String` | `getErrorCodeForDecomposingFunctionItems()` |
    `NamePool` | `getNamePool()` | Get the name pool
    `PipelineConfiguration` | `getPipelineConfiguration()` | Get the pipeline configuration
    `java.lang.String` | `getSystemId()` | Get the system ID
    `boolean` | `handlesAppend()` | Ask whether this Receiver can handle arbitrary items in its `Outputter.append(net.sf.saxon.om.Item, net.sf.saxon.s9api.Location, int)` and `Outputter.append(Item, Location, int)` methods.
    `void` | `open()` | Start the output process
    `void` | `setPipelineConfiguration​(PipelineConfiguration pipelineConfiguration)` | Set the pipeline configuration
    `void` | `setSystemId​(java.lang.String systemId)` | Set the system ID
    `void` | `setUnparsedEntity​(java.lang.String name, java.lang.String systemID, java.lang.String publicID)` | Notify an unparsed entity URI.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

    - ### Methods inherited from interface net.sf.saxon.event.Receiver

      `characters, close, comment, endDocument, endElement, processingInstruction, startDocument, startElement, usesTypeAnnotations`

- - ### Field Detail

    - #### previousAtomic

          protected boolean previousAtomic

    - #### pipelineConfiguration

          protected PipelineConfiguration pipelineConfiguration

    - #### systemId

          protected java.lang.String systemId

  - ### Constructor Detail

    - #### SequenceReceiver

          public SequenceReceiver​(PipelineConfiguration pipe)

      Create a SequenceReceiver
      Parameters:
        `pipe` - the pipeline configuration

  - ### Method Detail

    - #### getPipelineConfiguration

          public final PipelineConfiguration getPipelineConfiguration()

      Description copied from interface: `Receiver`
      Get the pipeline configuration
      Specified by:
        `getPipelineConfiguration` in interface `Receiver`
      Returns:
        the pipeline configuration

    - #### setPipelineConfiguration

          public void setPipelineConfiguration​(PipelineConfiguration pipelineConfiguration)

      Description copied from interface: `Receiver`
      Set the pipeline configuration
      Specified by:
        `setPipelineConfiguration` in interface `Receiver`
      Parameters:
        `pipelineConfiguration` - the pipeline configuration

    - #### getConfiguration

          public final Configuration getConfiguration()

      Get the Saxon Configuration
      Returns:
        the Configuration

    - #### setSystemId

          public void setSystemId​(java.lang.String systemId)

      Set the system ID
      Specified by:
        `setSystemId` in interface `Receiver`
      Specified by:
        `setSystemId` in interface `javax.xml.transform.Result`
      Parameters:
        `systemId` - the URI used to identify the tree being passed across this interface

    - #### getSystemId

          public java.lang.String getSystemId()

      Get the system ID
      Specified by:
        `getSystemId` in interface `javax.xml.transform.Result`
      Returns:
        the system ID that was supplied using the setSystemId() method

    - #### setUnparsedEntity

          public void setUnparsedEntity​(java.lang.String name,
                                        java.lang.String systemID,
                                        java.lang.String publicID)
                                 throws XPathException

      Notify an unparsed entity URI.
      Specified by:
        `setUnparsedEntity` in interface `Receiver`
      Parameters:
        `name` - The name of the unparsed entity
        `systemID` - The system identifier of the unparsed entity
        `publicID` - The public identifier of the unparsed entity
      Throws:
        `XPathException` - if an error occurs

    - #### open

          public void open()
                    throws XPathException

      Start the output process
      Specified by:
        `open` in interface `Receiver`
      Throws:
        `XPathException` - if an error occurs

    - #### append

          public abstract void append​(Item item,
                                      Location locationId,
                                      int properties)
                               throws XPathException

      Append an arbitrary item (node, atomic value, or function) to the output
      Specified by:
        `append` in interface `Receiver`
      Parameters:
        `item` - the item to be appended
        `locationId` - the location of the calling instruction, for diagnostics
        `properties` - if the item is an element node, this indicates whether its namespaces need to be copied. Values are `ReceiverOption.ALL_NAMESPACES`; the default (0) means
      Throws:
        `XPathException` - if an error occurs

    - #### append

          public void append​(Item item)
                      throws XPathException

      Append an arbitrary item (node, atomic value, or function) to the output. By default, if the item is an element node, it is copied with all namespaces.
      Specified by:
        `append` in interface `Receiver`
      Parameters:
        `item` - the item to be appended
      Throws:
        `XPathException` - if the operation fails

    - #### getNamePool

          public NamePool getNamePool()

      Get the name pool
      Returns:
        the Name Pool that was supplied using the setConfiguration() method

    - #### flatten

          protected void flatten​(ArrayItem array,
                                 Location locationId,
                                 int copyNamespaces)
                          throws XPathException

      Helper method for subclasses to invoke if required: flatten an array. The effect is that each item in each member of the array is appended to this `SequenceReceiver` by calling its `method`
      Parameters:
        `array` - the array to be flattened
        `locationId` - the location of the instruction triggering this operation
        `copyNamespaces` - options for copying namespace nodes
      Throws:
        `XPathException` - if things go wrong

    - #### decompose

          protected void decompose​(Item item,
                                   Location locationId,
                                   int copyNamespaces)
                            throws XPathException

      Helper method for subclasses to invoke if required: decompose an item into a sequence of node events. Note that when this is used, methods such as characters(), comment(), startElement(), and processingInstruction() are responsible for setting previousAtomic to false.
      Parameters:
        `item` - the item to be decomposed (that is, to be delivered to this `SequenceReceiver` as a sequence of separate events
        `locationId` - the location of the originating instruction
        `copyNamespaces` - options for copying namespace nodes
      Throws:
        `XPathException` - if things go wrong

    - #### getErrorCodeForDecomposingFunctionItems

          protected java.lang.String getErrorCodeForDecomposingFunctionItems()

    - #### handlesAppend

          public boolean handlesAppend()

      Ask whether this Receiver can handle arbitrary items in its `Outputter.append(net.sf.saxon.om.Item, net.sf.saxon.s9api.Location, int)` and `Outputter.append(Item, Location, int)` methods. If it cannot, then calling these methods will raise an exception (typically but not necessarily an `UnsupportedOperationException`). This implementation returns true.
      Specified by:
        `handlesAppend` in interface `Receiver`
      Returns:
        true if the Receiver is able to handle items supplied to its `Outputter.append(net.sf.saxon.om.Item, net.sf.saxon.s9api.Location, int)` and `Outputter.append(Item, Location, int)` methods. A receiver that returns true may still reject some kinds of item, for example it may reject function items.