Class InSituValidator

  extended by com.saxonica.validate.InSituValidator

public class InSituValidator
extends 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
InSituValidator(MutableNodeInfo root, int validationMode)
          Create an InSituValidator
Method Summary
 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


public InSituValidator(MutableNodeInfo root,
                       int validationMode)
Create an InSituValidator

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


public void validate()
              throws XPathException
Perform the validation

XPathException - if it is not possible to construct a validator, or if validation fails.

Copyright (c) 2004-2010 Saxonica Limited. All rights reserved.