com.saxonica.stream
Interface Watch

All Known Implementing Classes:
FieldWatch, KeySelectorWatch, RefSelectorWatch, SelectorWatch, SubtreeCopyWatch

public interface Watch

A Watch represents a class that is interested in looking at nodes passing down a push pipeline, typically for the purpose of evaluating uniqueness and key constraints. The nodes that the Watch is interested in are identified by a Selection object.


Method Summary
 Receiver activate(int locationId, int matchKind)
          Signal that an element has been found that matches the selection that this Watch is looking for.
 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 deactivate(int locationId)
          Signal that the endElement event has occurred for the element whose startElement event caused the Watch to be activated.
 int getOriginDepth()
          Get the depth within the XML hierarchy of the element whose element declaration contains the unique/key/keyref constraint that this Watch implements
 Selection getSelection()
          Get the selection (that is, the restricted XPath expression) that defines the nodes that this Watch is looking for
 void setNamespaceResolver(NamespaceResolver resolver)
          Set a NamespaceResolver for use by the Watch
 void setOriginDepth(int depth)
          Set the depth within the XML hierarchy of the element whose element declaration contains the unique/key/keyref constraint that this Watch implements
 void setPipelineConfiguration(PipelineConfiguration config)
          Set the Configuration in use
 

Method Detail

getSelection

Selection 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 config)
Set the Configuration in use

Parameters:
config - the Configuration in use

setNamespaceResolver

void setNamespaceResolver(NamespaceResolver resolver)
Set a NamespaceResolver for use by the Watch

Parameters:
resolver - the namespace resolver to be used

setOriginDepth

void setOriginDepth(int depth)
Set the depth within the XML hierarchy of the element whose element declaration contains the unique/key/keyref constraint that this Watch implements

Parameters:
depth - The depth at which the watch is scoped

getOriginDepth

int getOriginDepth()
Get the depth within the XML hierarchy of the element whose element declaration contains the unique/key/keyref constraint that this Watch implements

Returns:
The depth at which the watch is scoped

activate

Receiver activate(int locationId,
                  int matchKind)
                  throws ValidationException
Signal that an element has been found that matches the selection that this Watch is looking for. This method is called by the ConstraintChecker while processing the startElement event that matches the selection. For this purpose, any attributes selected by the last step in the selection are ignored

Parameters:
locationId - the location of the element
matchKind - indicates whether the match was on an element in its own right, or as parent of a matched attribute, or both
Returns:
a Receiver to be notified of all events starting with the startElement 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

deactivate

void deactivate(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:
ValidationException - May be raised if the constraint implemented by this Watch is violated
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


Copyright (c) Saxonica Limited. All rights reserved.