Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.saxonica.stream.watch
Interface Watch

All Known Implementing Classes:
  AbstractWatch, ApplyImportsWatch, ApplyTemplatesWatch, ComposingWatch, CopyOfWatch, CountWatch, EmptyWatch, EventPushingWatch, ExistsWatch, FieldWatch, ForEachComposingWatch, ForEachWatch, IterateWatch, KeySelectorWatch, NextMatchWatch, NonstreamingExpressionWatch, RefSelectorWatch, SelectorWatch, SimpleContentWatch, StringValueWatch, TypedValueWatch, VoidWatch

    public interface Watch

A Watch represents a class that is interested in looking at nodes passing down a push pipeline. Originally this was for the purpose of evaluating uniqueness and key constraints while validating an instance document against a schema; now it us used for many expressions that need to be evaluated in streaming mode.

The nodes that the Watch is interested in are identified by a Selection object.

Method Summary
`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.
`FleetingNode` | `getAnchorNode()` Get the anchor node for the watch.
`NamespaceResolver` | `getNamespaceResolver()` Get the namespace resolver in use by the Watch
`PipelineConfiguration` | `getPipelineConfiguration()` Get the pipeline configuration in use
`Pattern` | `getSelection()` Get the selection (that is, the restricted XPath expression) that defines the nodes that this Watch is looking for
`void` | `notifySelectedLeafNode(FleetingNode node, int locationId)` Signal that a node (other than a document or element node) that matches the selection has been found.
`void` | `open()` Open the watch.
`void` | `setAnchorNode(FleetingNode anchor)` Set the anchor node for the watch.
`void` | `setNamespaceResolver(NamespaceResolver resolver)` Set a NamespaceResolver for use by the Watch
`void` | `setPipelineConfiguration(PipelineConfiguration pipe)` Set the pipeline configuration in use
`void` | `setSelection(Pattern selection)` Set the selection (that is, the streamable XPath expression) that defines the nodes that this Watch is looking for
`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.

Method Detail

### setSelection

    void setSelection(Pattern selection)

  Set the selection (that is, the streamable XPath expression) that defines the nodes that this Watch is looking for

  Parameters:
    `selection` - the streamable XPath expression

### getSelection

    Pattern getSelection()

  Get the selection (that is, the restricted XPath expression) that defines the nodes that this Watch is looking for

  Returns:
    the selection

### setPipelineConfiguration

    void setPipelineConfiguration(PipelineConfiguration pipe)

  Set the pipeline configuration in use

  Parameters:
    `pipe` - the pipeline Configuration in use

### getPipelineConfiguration

    PipelineConfiguration getPipelineConfiguration()

  Get the pipeline configuration in use

  Returns:
    the pipeline configuration

### setNamespaceResolver

    void setNamespaceResolver(NamespaceResolver resolver)

  Set a NamespaceResolver for use by the Watch

  Parameters:
    `resolver` - the namespace resolver to be used

### getNamespaceResolver

    NamespaceResolver getNamespaceResolver()

  Get the namespace resolver in use by the Watch

  Returns:
    the namespace resolver

### setAnchorNode

    void setAnchorNode(FleetingNode anchor)

  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.

  Parameters:
    `anchor` - The anchor node within which the watch is scoped

### getAnchorNode

    FleetingNode getAnchorNode()

  Get 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.

  Returns:
    The anchor node within which the watch is scoped

### open

    void open()
              throws XPathException

  Open the watch. This is done at the point where it first starts watching for nodes that match the selection.

  Throws:
    `XPathException`

### startSelectedParentNode

    Receiver startSelectedParentNode(FleetingNode node,
                                     int locationId)
                                     throws XPathException

  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.
  Throws:
    `ValidationException` - May be raised if the constraint implemented by this Watch is violated
    `XPathException`

### endSelectedParentNode

    void endSelectedParentNode(int locationId)
                               throws XPathException

  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

### notifySelectedLeafNode

    void notifySelectedLeafNode(FleetingNode node,
                                int locationId)
                                throws XPathException

  Signal that a node (other than a document or element node) that matches the selection has been found.

  Parameters:
    `node` - the node that was matched.
    `locationId` -
  Throws:
    `XPathException`

### close

    void close()
               throws XPathException

  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.

  Throws:
    `XPathException`

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

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