Package com.saxonica.ee.validate

## Class InSituValidator

- java.lang.Object
- - com.saxonica.ee.validate.InSituValidator

-     public class InSituValidator
      extends java.lang.Object

  This class performs in-situ validation of a tree represented in memory as a NodeInfo object. The standard copy() method is used to copy the tree to a validation pipeline as a sequence of events. The locationId on these events is used to maintain a mapping back to the original nodes in the tree, so that the original tree can be updated with type annotations and expanded defaults reflecting the decisions of the validator.

  Note that if validation fails, the tree will not be in a usable state. For this reason it may be desirable to do the validation twice, once with a Sink as the destination, and only use the in-situ validation once it is known that it will succeed.

- - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `InSituValidator​(MutableNodeInfo root, int validationMode)` | Create an InSituValidator

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `void` | `validate()` | Perform the validation

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### InSituValidator

          public InSituValidator​(MutableNodeInfo root,
                                 int validationMode)

      Create an InSituValidator
      Parameters:
        `root` - the root node of the tree to be validated. This must be a document or element node, and it must be an updateable node
        `validationMode` - the validation mode: `Validation.STRICT` or `Validation.LAX`

  - ### Method Detail

    - #### validate

          public void validate()
                        throws XPathException

      Perform the validation
      Throws:
        `XPathException` - if it is not possible to construct a validator, or if validation fails.