The validation package contains classes used to validate document instances against a schema.
This validation is all performed "on-the-fly", by a collection of classes that implement Saxon's (SAX-like) Receiver interface, which is notified of start/end element events, attributes, and text nodes, as they occur. A pipeline of such classes is used both while processing input documents and while writing output documents, and in both cases, validation classes can be added to the pipeline.
Local validation of elements is controlled using the ValidationStack class, which manages a stack of validators for each element that is currently open. The most interesting of these is the ComplexContentValidator, which makes use of a finite state machine created by compiling a ComplexType in the schema. The finite state machine is represented by the AutomatonState object corresponding to the initial (entry) state of the machine.
Global validation of uniqueness and referential constraints is controlled using the ConstraintChecker class. The maintains a set of Watch classes that are interested in elements matching particular (restricted) XPath expressions. The restricted XPath expression used in XML Schema (which is similar to, but not identical to, an XPath pattern) is represented by a Selection object. Implementations of the Watch class are used to handle the different kinds of constraint that a schema can specify.
None of the classes in this package will normally be used directly by user applications.
Class Summary Class Description AbstractReceiverAn abstract implementation of
Receiverin which all events are (by default) ignored
AllElementValidatorThis class is validator used to check the content of an element whose complex type uses the "xs:all" construction in XML Schema. AnyTypeValidatorValidator to validate an element against the class xs:anyType AssertionTreeBuilderThis class sits in the validation pipeline, ready (when requested) to build subtrees of the validated document for use in testing assertions against complex types. AttributeInheritorThis class handles attribute inheritance. AttributeValidatorThis class is an abstract superclass for all the receivers that do element content validation. CatchingReceiverThis class catches all errors thrown by a Receiver pipeline, and reports them to a specified ErrorReporter; after an error has occurred, all further events are ignored. CompactStringValueA compact representation of an atomic xs:string value used in saved tables for key and keyref constraints, designed to economize on space. ComplexContentValidatorThis class is a filter that is used to validate the content of an element with a complex type. ConstraintCheckerThis class handles the checking of Schema-defined unique, key, and keyref constraints. ContentValidatorThis class is an abstract superclass for all the validators. EmptyContentValidatorThis class is a filter that is used to validate that an element has empty content. EntityValidatorThis class validates that elements and attributes of type ENTITY or ENTITIES have values are declared in the DOCTYPE declaration of the instance document as unparsed entities. FieldCheckerA FieldChecker is instantiated when a field in an identity constraint is matched; it receives notification of all events until the end of the element (or attribute) that matched the selector. FieldWatchA FieldWatch is a class that is looking for nodes that match a field selector within a uniqueness or key constraint. IdValidatorThis class validates that ID elements and attributes have unique values and that IDREF and IDREFS elements and attributes refer to an ID in the same document. InSituValidatorThis class performs in-situ validation of a tree represented in memory as a NodeInfo object. InvalidityReportGeneratorEEThis class
InvalidityReportGeneratorextends the standard error handler for errors found during validation of an instance document against a schema, used if user specifies -report option on validate.
KeySelectorWatchThis class watches the selector for a key or unique constraint LaxValidatorThis class performs lax validation on an element. RefSelectorWatchThis class watches the selector for a keyref constraint SchemaAttributeTestA NodeTest of the form schema-attribute(attribute-name) SchemaElementTestA NodeTest of the form schema-element(element-name) SelectorWatchA Watch represents a class that is interested in looking at nodes for the purpose of evaluating uniqueness and key constraints. SimpleContentValidatorThis class is a filter that is used to validate that an element has simple content conforming to a given simple type. SkipValidatorThis class is a filter that passes all Receiver events through unchanged, except that it removes all type annotations from element and attribute nodes. StatisticsReporterGenerates statistics relating to a validation episode ValidatingFilterThis class is used for a filter on the validation pipeline. ValidationContextThis class defines information about a validation episode ValidationStackThis class manages the receivers that do element content validation. XSIAttributeHandlerThis class processes attributes such as xsi:schemaLocation and xsi:type.
Enum Summary Enum Description ContentValidator.Nillability