Free Trial - Stylus Studio, The World's Best XML IDE!


com.saxonica.validate
Class FieldWatch

java.lang.Object
  |
  +--com.saxonica.validate.FieldWatch
All Implemented Interfaces:
Watch

public class FieldWatch
extends java.lang.Object
implements Watch

A FieldWatch is a class that is looking for nodes that match a field selector within a uniqueness or key constraint.


Constructor Summary
FieldWatch(SelectorWatch parentWatch, Selection selection, Value[] currentRow, int column)
          Create a new FieldWatch
 
Method Summary
 void activate(int typeCode, int activationDepth)
          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()
          Signal that the endElement event has occurred for the element whose startElement event caused the Watch to be activated.
 int getActivationDepth()
          If the Watch is active, return the activation depth (the depth in the XML tree at which it was activated; otherwise return -1
 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 definesthis the nodes that this Watch is looking for
 void notifyAttribute(int nameCode, int typeCode, java.lang.CharSequence value)
          Notify an attribute to a Watch that has been activated.
 void notifyText(java.lang.CharSequence value)
          Notify the character content of an element to a Watch that has been activated.
 void setConfiguration(Configuration config)
          Set the NamePool in use
 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
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FieldWatch

public FieldWatch(SelectorWatch parentWatch,
                  Selection selection,
                  Value[] currentRow,
                  int column)
Create a new FieldWatch

Parameters:
parentWatch - The SelectorWatch to which field values should be notified
selection - The selection (that is, the restricted XPath expression) used in this field of the constraint
currentRow - represents the selected node whose fields are being evaluated
column - sequence number for this field within the constraint being evaluated
Method Detail

getSelection

public Selection getSelection()
Get the selection (that is, the restricted XPath expression) that definesthis the nodes that this Watch is looking for

Specified by:
getSelection in interface Watch
Returns:
the selection

setConfiguration

public void setConfiguration(Configuration config)
Set the NamePool in use

Specified by:
setConfiguration in interface Watch
Parameters:
config - the NamePool in use

getOriginDepth

public 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

Specified by:
getOriginDepth in interface Watch
Returns:
The depth at which the watch is scoped

setOriginDepth

public 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

Specified by:
setOriginDepth in interface Watch
Parameters:
depth - The depth at which the watch is scoped

activate

public void activate(int typeCode,
                     int activationDepth)
              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

Specified by:
activate in interface Watch
Parameters:
typeCode - The type annotation of the element that matches the selection
activationDepth - The depth in the XML tree at which the activation took place
Throws:
ValidationException - May be raised if the constraint implemented by this Watch is violated

getActivationDepth

public int getActivationDepth()
If the Watch is active, return the activation depth (the depth in the XML tree at which it was activated; otherwise return -1


deactivate

public void deactivate()
                throws ValidationException
Signal that the endElement event has occurred for the element whose startElement event caused the Watch to be activated.

Specified by:
deactivate in interface Watch
Throws:
ValidationException - May be raised if the constraint implemented by this Watch is violated

notifyAttribute

public void notifyAttribute(int nameCode,
                            int typeCode,
                            java.lang.CharSequence value)
                     throws ValidationException
Notify an attribute to a Watch that has been activated. Every attribute is notified to every watch that is interested in attributes; it is up to the Watch itself to decide whether this particular attribute is relevant.

Parameters:
nameCode - Identifies the name of the attribute
typeCode - The type annotation of the attribute
value - The value of the attribute
Throws:
ValidationException - May be raised if the constraint implemented by this Watch is violated

notifyText

public void notifyText(java.lang.CharSequence value)
                throws ValidationException
Notify the character content of an element to a Watch that has been activated. This is notified to every active Watch that is interested in element content.

Parameters:
value - The textual content of the element
Throws:
ValidationException - May be raised if the constraint implemented by this Watch is violated

close

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

Specified by:
close in interface Watch


Stylus Studio features integrated development and debugging support for Saxon in the XQuery editor and XSLT editor.