Package com.saxonica.ee.stream.watch
Class PatternWatch
java.lang.Object
com.saxonica.ee.stream.watch.AbstractWatch
com.saxonica.ee.stream.watch.PatternWatch
- All Implemented Interfaces:
Watch
- Direct Known Subclasses:
AccumulatorWatch
,FieldWatch
,MultiAccumulatorWatch
,SelectorWatch
,Trigger
A Watch represents a class that is interested in looking at nodes for the purpose
of evaluating uniqueness and key constraints, or for XSLT streaming; specifically,
an implementation of Watch that retains a Pattern which is evaluated to see whether
a particular node matches the Watch.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
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.final FleetingParentNode
Get the anchor node for the watch.Get the selection (that is, the restricted XPath expression) that defines the nodes that this Watch is looking forboolean
matchesNode
(FleetingNode node, XPathContext context) Determine whether the watch matches a given nodeboolean
matchesNodesOfKind
(UType kind) Ask whether the Watch is capable of matching nodes of a particular kindvoid
open
(Terminator terminator) Open the watch.void
processItem
(Item item) Signal that a node (other than an element) that matches the selection has been found.void
setAnchorNode
(FleetingParentNode anchor) Set the anchor node for the watch.void
setSelection
(Pattern selection) Set the selection (that is, the streamable XPath expression) that defines the nodes that this Watch is looking forMethods inherited from class com.saxonica.ee.stream.watch.AbstractWatch
getNamespaceResolver, getPipelineConfiguration, setNamespaceResolver, setPipelineConfiguration
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.saxonica.ee.stream.watch.Watch
endSelectedParentNode, startSelectedParentNode
-
Constructor Details
-
PatternWatch
public PatternWatch()
-
-
Method Details
-
matchesNode
Determine whether the watch matches a given node- Parameters:
node
- the node to be testedcontext
- the XPath dynamic context- Returns:
- true if the node is one of those the Watch is looking out for
- Throws:
XPathException
- if a dynamic error occurs
-
matchesNodesOfKind
Ask whether the Watch is capable of matching nodes of a particular kind- Parameters:
kind
- the node kind as a UType- Returns:
- true if the watch is capabl of matching
-
setSelection
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
Get the selection (that is, the restricted XPath expression) that defines the nodes that this Watch is looking for- Returns:
- the selection
-
setAnchorNode
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
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
Open the watch. This is done at the point where it first starts watching for nodes that match the selection.- Specified by:
open
in interfaceWatch
- Overrides:
open
in classAbstractWatch
- Parameters:
terminator
- action to be taken on failure- Throws:
XPathException
- May be raised if a dynamic error occurs
-
processItem
Signal that a node (other than an element) that matches the selection has been found.- Specified by:
processItem
in interfaceWatch
- Overrides:
processItem
in classAbstractWatch
- Parameters:
item
- the node that was matched.- Throws:
XPathException
- May be raised if a dynamic error occurs
-
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. The default implementation does nothing.- Specified by:
close
in interfaceWatch
- Overrides:
close
in classAbstractWatch
- Throws:
XPathException
- May be raised if a dynamic error occurs
-