com.saxonica.stream.watch

## Class ForkingWatch

- java.lang.Object
- - com.saxonica.validate.AbstractWatch
  - - com.saxonica.stream.watch.ForkingWatch

- All Implemented Interfaces:
    Watch

      public class ForkingWatch
      extends AbstractWatch

  Process an xsl:fork instruction, by feeding events to each of multiple destinations.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `ForkingWatch(WatchManager watchManager, Watch[] children, RetainingFeed[] buffers, Feed destination)`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `close()` The close() method is called immediately before the Watch is destroyed, that is, when the element whose declaration scopes the constraint implemented by this Watch goes out of scope.
    `void` | `endSelectedParentNode(int locationId)` Signal that the endElement event has occurred for the element whose startElement event caused the Watch to be activated.
    `void` | `notifySelectedLeafNode(FleetingNode node, int locationId)` Signal that a node (other than an element) that matches the selection has been found.
    `void` | `open()` Open the watch.
    `void` | `setAnchorNode(FleetingNode anchor)` Set the anchor node for the watch.
    `Receiver` | `startSelectedParentNode(FleetingNode node, int locationId)` Signal that an element or document node has been found that matches the selection that this Watch is looking for.

    - ### Methods inherited from class com.saxonica.validate.AbstractWatch

      `getAnchorNode, getNamespaceResolver, getPipelineConfiguration, getSelection, setNamespaceResolver, setPipelineConfiguration, setSelection`

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

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

- - ### Constructor Detail

    - #### ForkingWatch

          public ForkingWatch(WatchManager watchManager,
                      Watch[] children,
                      RetainingFeed[] buffers,
                      Feed destination)
                       throws XPathException

      Throws:
        `XPathException`

  - ### Method Detail

    - #### setAnchorNode

          public void setAnchorNode(FleetingNode anchor)

      Description copied from class: `AbstractWatch`
      Set the anchor node for the watch. This is the node to which the watch is scoped, typically the context node for the streamable path expression that defines the root of the subtree within which nodes are being sought.
      Specified by:
        `setAnchorNode` in interface `Watch`
      Overrides:
        `setAnchorNode` in class `AbstractWatch`
      Parameters:
        `anchor` - The anchor node within which the watch is scoped

    - #### open

          public void open()
                    throws XPathException

      Description copied from class: `AbstractWatch`
      Open the watch. This is done at the point where it first starts watching for nodes that match the selection.
      Specified by:
        `open` in interface `Watch`
      Overrides:
        `open` in class `AbstractWatch`
      Throws:
        `XPathException`

    - #### notifySelectedLeafNode

          public void notifySelectedLeafNode(FleetingNode node,
                                    int locationId)
                                      throws XPathException

      Description copied from class: `AbstractWatch`
      Signal that a node (other than an element) that matches the selection has been found.
      Specified by:
        `notifySelectedLeafNode` in interface `Watch`
      Overrides:
        `notifySelectedLeafNode` in class `AbstractWatch`
      Parameters:
        `node` - the node that was matched.
        `locationId` - the location for use in error messages
      Throws:
        `XPathException`

    - #### close

          public void close()
                     throws XPathException

      Description copied from class: `AbstractWatch`
      The close() method is called immediately before the Watch is destroyed, that is, when the element whose declaration scopes the constraint implemented by this Watch goes out of scope. The default implementation does nothing.
      Specified by:
        `close` in interface `Watch`
      Overrides:
        `close` in class `AbstractWatch`
      Throws:
        `XPathException`

    - #### startSelectedParentNode

          public Receiver startSelectedParentNode(FleetingNode node,
                                         int locationId)
                                           throws XPathException

      Description copied from interface: `Watch`
      Signal that an element or document node has been found that matches the selection that this Watch is looking for. This method is called by the WatchManager while processing the startElement or startDocument event that matches the selection.
      Parameters:
        `node` - the element or document node whose start event has been matched
        `locationId` - the location associated with the element or document node (may be the location of the instruction that created it)
      Returns:
        a Receiver to be notified of all events starting with the startElement/startDocument event for the matched element, and ending with the endElement event for that element; or null if this feature is not required.
      Throws:
        `XPathException` - May be raised if a dynamic error occurs

    - #### endSelectedParentNode

          public void endSelectedParentNode(int locationId)
                                     throws XPathException

      Description copied from interface: `Watch`
      Signal that the endElement event has occurred for the element whose startElement event caused the Watch to be activated.
      Parameters:
        `locationId` - the location of the element
      Throws:
        `XPathException` - May be raised if a constraint implemented by this Watch is violated

Copyright (c) 2004-2013 Saxonica Limited. All rights reserved.