Source for org.relaxng.datatype.DatatypeStreamingValidator

   1: package org.relaxng.datatype;
   2: 
   3: /**
   4:  * Datatype streaming validator.
   5:  * 
   6:  * <p>
   7:  * The streaming validator is an optional feature that is useful for
   8:  * certain Datatypes. It allows the caller to incrementally provide
   9:  * the literal.
  10:  * 
  11:  * @author <a href="mailto:jjc@jclark.com">James Clark</a>
  12:  * @author <a href="mailto:kohsuke.kawaguchi@sun.com">Kohsuke KAWAGUCHI</a>
  13:  */
  14: public interface DatatypeStreamingValidator {
  15:     
  16:     /**
  17:      * Passes an additional fragment of the literal.
  18:      * 
  19:      * <p>
  20:      * The application can call this method several times, then call
  21:      * the isValid method (or the checkValid method) to check the validity
  22:      * of the accumulated characters.
  23:      */
  24:     void addCharacters( char[] buf, int start, int len );
  25:     
  26:     /**
  27:      * Tells if the accumulated literal is valid with respect to
  28:      * the underlying Datatype.
  29:      * 
  30:      * @return
  31:      *        True if it is valid. False if otherwise.
  32:      */
  33:     boolean isValid();
  34:     
  35:     /**
  36:      * Similar to the isValid method, but this method throws
  37:      * Exception (with possibly diagnostic information), instead of
  38:      * returning false.
  39:      * 
  40:      * @exception DatatypeException
  41:      *        If the callee supports the diagnosis and the accumulated
  42:      *        literal is invalid, then this exception that possibly
  43:      *        contains diagnosis information is thrown.
  44:      */
  45:     void checkValid() throws DatatypeException;
  46: }