|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.saxonica.validate.SelectorWatch
public abstract class SelectorWatch
A Watch represents a class that is interested in looking at nodes for the purpose of evaluating uniqueness and key constraints. A SelectorWatch looks for the nodes that match the selector in a unique, key, or keyref constraint. There are two concrete subclasses: one for key/unique, the other for keyref
Constructor Summary | |
---|---|
SelectorWatch(ConstraintChecker checker,
IdentityConstraint uniqueConstraint)
|
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 |
addFieldValue(Value[] currentRow,
int column,
Value value,
boolean nillableElement,
long locationId)
The addFieldValue method is a callback from the FieldWatch created when this SelectorWatch is activated. |
protected void |
checkRow(Value[] currentRow,
boolean isTarget,
int locationId)
Method to check that a row (that is, the collection of fields corresponding to one selected node) is valid. |
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. |
protected String |
displayRow(Value[] row)
Internal method to display the contents of a row, for diagnostics |
IdentityConstraint |
getIdentityConstraint()
Get the identityConstraint implemented by this SelectorWatch |
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 |
protected void |
reportValidationError(ValidationException err,
long locationId)
Report a validation error |
protected void |
reportValidationError(ValidationException err,
SourceLocator locator)
Report a validation error |
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 pipe)
Set the PipelineConfiguration in use |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public SelectorWatch(ConstraintChecker checker, IdentityConstraint uniqueConstraint)
Method Detail |
---|
public IdentityConstraint getIdentityConstraint()
public Selection getSelection()
getSelection
in interface Watch
public void setPipelineConfiguration(PipelineConfiguration pipe)
setPipelineConfiguration
in interface Watch
pipe
- the PipelineConfiguration in usepublic void setNamespaceResolver(NamespaceResolver resolver)
setNamespaceResolver
in interface Watch
resolver
- the namespace resolver to be usedpublic void setOriginDepth(int depth)
setOriginDepth
in interface Watch
depth
- The depth at which the watch is scoped. This corresponds to the elementStackTop level
in the controlling WatchHandler, for the startElement event that is the first level notified to the
watch. For example, an xs:unique constraint declared on the outermost element of the document will have
an origin depth of zero. For a FieldWatch, the origin depth is the difference between the level at
which the SelectorWatch is scoped, and the level at which it was activated. This for a constraint
defined at BOOKLIST level with select xpath="BOOK" and field xpath="ISBN", the constraint will be
scoped at level zero, and activated at level one; the origin depth for the Field Watch will be one.public int getOriginDepth()
getOriginDepth
in interface Watch
public Receiver activate(int locationId, int matchKind) throws ValidationException
activate
in interface Watch
locationId
- the location of the elementmatchKind
- indicates whether the match was on an element in its own right, or as
parent of a matched attribute, or both
ValidationException
- May be raised if the constraint implemented by this
Watch is violatedpublic void deactivate(int locationId) throws ValidationException
deactivate
in interface Watch
locationId
- the location of the element
ValidationException
- May be raised if the constraint implemented by this
Watch is violated @param locationIdpublic void close() throws ValidationException
close
in interface Watch
ValidationException
public void addFieldValue(Value[] currentRow, int column, Value value, boolean nillableElement, long locationId) throws ValidationException
currentRow
- identifying the node to which this field value
appliescolumn
- identifies which of the fields participating in this constraint
the value relates tovalue
- The value of the field that was encounterednillableElement
- True if the field represents a nillable elementlocationId
- the location of the data in the source document
ValidationException
- May be raised if the value of the field violates
the constraintprotected void checkRow(Value[] currentRow, boolean isTarget, int locationId) throws ValidationException
currentRow
- the values of the set of fieldsisTarget
- set to true if this is a value of the key referred to
by a key reference, rather than a value for this constraint's own selected
fields.locationId
- identifies the location of the selected node
ValidationException
- is raised if the value of the row (that is,
the combination of fields) violates the constraintprotected String displayRow(Value[] row)
protected void reportValidationError(ValidationException err, long locationId) throws ValidationException
err
- The validation exceptionlocationId
- identifies the location in the source document or stylesheet/query where the
validation error was detected
ValidationException
protected void reportValidationError(ValidationException err, SourceLocator locator) throws ValidationException
err
- The validation exceptionlocator
- identifies the location in the source document or stylesheet/query where the
validation error was detected
ValidationException
|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |