com.saxonica.validate

## Class ValidatingFilter

- java.lang.Object
- - net.sf.saxon.event.SequenceReceiver
  - - net.sf.saxon.event.ProxyReceiver
    - - com.saxonica.validate.ValidatingFilter

- All Implemented Interfaces:
    Result, Receiver
  Direct Known Subclasses:
    ContentValidator, ValidationStack, XSIAttributeHandler

      public class ValidatingFilter
      extends ProxyReceiver

  This class is used for a filter on the validation pipeline. It provides error reporting services to each of the filters.

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected boolean` | `locallyInvalid`

    - ### Fields inherited from class net.sf.saxon.event.ProxyReceiver

      `nextReceiver`

    - ### Fields inherited from class net.sf.saxon.event.SequenceReceiver

      `pipelineConfiguration, previousAtomic, systemId`

    - ### Fields inherited from interface javax.xml.transform.Result

      `PI_DISABLE_OUTPUT_ESCAPING, PI_ENABLE_OUTPUT_ESCAPING`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `ValidatingFilter(Receiver next)`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `append(Item item, int locationId, int copyNamespaces)` Append an arbitrary item (node or atomic value) to the output
    `protected ConstraintChecker` | `getConstraintChecker()` Get the constraint checker used in this pipeline
    `StartTagBufferEE` | `getStartTagBuffer()` Get the startTagBuffer
    `ValidationContext` | `getValidationContext()` Get the validation context for this validation episode
    `protected void` | `reportIfInvalid()`
    `protected void` | `reportValidationError(ValidationException err, boolean issueComment, int locationId)` Report a validation error
    `void` | `setConstraintChecker(ConstraintChecker checker)` Set the constraint checker used in this pipeline
    `void` | `setStartTagBuffer(StartTagBufferEE startTag)` Set the StartTagBuffer, which buffers attributes on the element start tag, and also acts as the namespaceResolver to be used for resolving QName-valued attributes
    `void` | `setValidationContext(ValidationContext validationContext)` Set the validation context for this validation episode
    `boolean` | `usesTypeAnnotations()` Ask whether this Receiver (or the downstream pipeline) makes any use of the type annotations supplied on element and attribute events

    - ### Methods inherited from class net.sf.saxon.event.ProxyReceiver

      `attribute, characters, close, comment, endDocument, endElement, getNamePool, getUnderlyingReceiver, namespace, open, processingInstruction, setPipelineConfiguration, setSystemId, setUnderlyingReceiver, setUnparsedEntity, startContent, startDocument, startElement`

    - ### Methods inherited from class net.sf.saxon.event.SequenceReceiver

      `append, getConfiguration, getPipelineConfiguration, getSystemId`

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

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

- - ### Field Detail

    - #### locallyInvalid

          protected boolean locallyInvalid

  - ### Constructor Detail

    - #### ValidatingFilter

          public ValidatingFilter(Receiver next)

  - ### Method Detail

    - #### getValidationContext

          public ValidationContext getValidationContext()

      Get the validation context for this validation episode
      Returns:
        the validation context

    - #### setValidationContext

          public void setValidationContext(ValidationContext validationContext)

      Set the validation context for this validation episode
      Parameters:
        `validationContext` -

    - #### setConstraintChecker

          public void setConstraintChecker(ConstraintChecker checker)

      Set the constraint checker used in this pipeline
      Parameters:
        `checker` - the constraint checker

    - #### getConstraintChecker

          protected ConstraintChecker getConstraintChecker()

      Get the constraint checker used in this pipeline
      Returns:
        the constraint checker

    - #### setStartTagBuffer

          public void setStartTagBuffer(StartTagBufferEE startTag)

      Set the StartTagBuffer, which buffers attributes on the element start tag, and also acts as the namespaceResolver to be used for resolving QName-valued attributes
      Parameters:
        `startTag` - the namespace resolver

    - #### getStartTagBuffer

          public StartTagBufferEE getStartTagBuffer()

      Get the startTagBuffer
      Returns:
        the startTagBuffer

    - #### usesTypeAnnotations

          public boolean usesTypeAnnotations()

      Ask whether this Receiver (or the downstream pipeline) makes any use of the type annotations supplied on element and attribute events
      Specified by:
        `usesTypeAnnotations` in interface `Receiver`
      Overrides:
        `usesTypeAnnotations` in class `ProxyReceiver`
      Returns:
        true if the Receiver makes any use of this information. If false, the caller may supply untyped nodes instead of supplying the type annotation. Validation filters overwrite any type annotations arriving in the input event stream, so this instance of the method returns false.

    - #### append

          public void append(Item item,
                    int locationId,
                    int copyNamespaces)
                      throws XPathException

      Description copied from class: `ProxyReceiver`
      Append an arbitrary item (node or atomic value) to the output
      Overrides:
        `append` in class `ProxyReceiver`
      Parameters:
        `item` - the item to be appended
        `locationId` - the location of the calling instruction, for diagnostics
        `copyNamespaces` - if the item is an element node, this indicates whether its namespaces need to be copied. Values are `NodeInfo.ALL_NAMESPACES`, `NodeInfo.LOCAL_NAMESPACES`, `NodeInfo.NO_NAMESPACES`
      Throws:
        `XPathException` - if the operation fails

    - #### reportValidationError

          protected void reportValidationError(ValidationException err,
                                   boolean issueComment,
                                   int locationId)
                                        throws XPathException

      Report a validation error
      Parameters:
        `err` - The validation exception
        `issueComment` - true if the validation error message is to be written as an XML comment to the result document
        `locationId` - identifies the location in the source document or stylesheet/query where the validation error was detected
      Throws:
        `XPathException` - if reporting the error fails

    - #### reportIfInvalid

          protected void reportIfInvalid()
                                  throws ValidationException

      Throws:
        `ValidationException`

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