Package com.saxonica.ee.validate
Class FieldWatch
java.lang.Object
com.saxonica.ee.stream.watch.AbstractWatch
com.saxonica.ee.stream.watch.PatternWatch
com.saxonica.ee.validate.FieldWatch
- All Implemented Interfaces:
Watch
A FieldWatch is a class that is looking for nodes that match a field
selector within a uniqueness or key constraint.
-
Constructor Summary
ConstructorsConstructorDescriptionFieldWatch
(SelectorWatch parentWatch, Pattern selection, AtomicSequence[] currentRow, int column) Create a new FieldWatch -
Method Summary
Modifier and TypeMethodDescriptionvoid
endSelectedParentNode
(Location locationId) Signal that the endElement event has occurred for the element whose startElement event caused the Watch to be activated.void
processItem
(Item item) Signal that a node (other than an element) that matches the selection has been found.startSelectedParentNode
(FleetingParentNode node, Location locationId) Signal that an element has been found that matches the selection that this Watch is looking for.Methods inherited from class com.saxonica.ee.stream.watch.PatternWatch
close, getAnchorNode, getSelection, matchesNode, matchesNodesOfKind, open, setAnchorNode, setSelection
Methods inherited from class com.saxonica.ee.stream.watch.AbstractWatch
getNamespaceResolver, getPipelineConfiguration, setNamespaceResolver, setPipelineConfiguration
-
Constructor Details
-
FieldWatch
public FieldWatch(SelectorWatch parentWatch, Pattern selection, AtomicSequence[] currentRow, int column) Create a new FieldWatch- Parameters:
parentWatch
- The SelectorWatch to which field values should be notifiedselection
- The selection (that is, the restricted XPath expression) used in this field of the constraintcurrentRow
- represents the selected node whose fields are being evaluatedcolumn
- sequence number for this field within the constraint being evaluated
-
-
Method Details
-
startSelectedParentNode
public FieldChecker startSelectedParentNode(FleetingParentNode node, Location locationId) throws XPathException 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:
node
- the element or document node whose start event has been matchedlocationId
- the location associated with the element or document node (may be the location of the instruction that created it)- Returns:
- a FieldChecker - a receiver that collects the contents of the selected node, or null
- Throws:
ValidationException
- May be raised if the constraint implemented by this Watch is violated @param locationId the location of the node in the source, or of the instruction that created itXPathException
- May be raised if a dynamic error occurs
-
endSelectedParentNode
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 node in the source, or of the instruction that created it- Throws:
ValidationException
- May be raised if the constraint implemented by this Watch is violated @param locationId the location of the node in the source, or of the instruction that created it
-
processItem
Signal that a node (other than an element) that matches the selection has been found.- Specified by:
processItem
in interfaceWatch
- Overrides:
processItem
in classPatternWatch
- Parameters:
item
- the node that was matched.- Throws:
XPathException
- May be raised if a dynamic error occurs
-