Class Verifier

    • Field Detail

      • errorHandler

        protected ErrorHandler errorHandler
        Error handler
      • hadError

        protected boolean hadError
        This flag will be set to true if an error is found
      • docDecl

        protected final DocumentDeclaration docDecl
        Schema object against which the validation will be done
      • panicLevel

        protected int panicLevel
        Panic level. If the level is non-zero, createChildAcceptors will silently recover from error. This effectively suppresses spurious error messages. This value is set to INITIAL_PANIC_LEVEL when first an error is encountered, and is decreased by successful stepForward and createChildAcceptor. This value is also propagated to child acceptors.
    • Method Detail

      • isValid

        public final boolean isValid()
        Description copied from interface: IVerifier
        checks if the document was valid. This method may not be called before verification was completed.
        Specified by:
        isValid in interface IVerifier
        Specified by:
        isValid in interface org.iso_relax.verifier.VerifierHandler
      • setPanicMode

        public final void setPanicMode​(boolean usePanicMode)
        Description copied from interface: IVerifier
        Turns on/off the panic mode. Panic mode is on by default. Turning it on is good for general use. It prevents false error messages to appear.

        However, turning it off is sometimes useful, when you are sure that the structure of the document is almost valid (e.g., validating a document generated by an application or when you are sure about the validity of the structure and only interested in validating datatypes,)

        Specified by:
        setPanicMode in interface IVerifier
      • getLastCharacterType

        public org.relaxng.datatype.Datatype[] getLastCharacterType()
        Description copied from interface: IVerifier
        gets DataType that validated the last characters.

        This method works correctly only when called immediately after startElement and endElement method. When called, this method returns DataType object that validated the last character literals.

        For RELAX NG grammar, this method can return an array of length 2 or more. This happens when the last character matches <list> pattern. In that case, each type corresponds to each token (where tokens are the white-space separation of the last characters).

        For any other grammar, this method always returns an array of length 1 (or null, if the type assignment failed).

        So when you are using VerifierFilter, you can call this method only in your startElement and endElement method.

        Specified by:
        getLastCharacterType in interface IVerifier
        Returns:
        null if type-assignment was not possible.
      • onNextAcceptorReady

        protected void onNextAcceptorReady​(StartTagInfo sti,
                                           Acceptor nextAcceptor)
                                    throws SAXException
        this method is called from the startElement method after the tag name is processed and the child acceptor is created.

        This method is called before the attributes are consumed.

        derived class can use this method to do something useful.

        Throws:
        SAXException
      • getCurrentElementType

        public Object getCurrentElementType()
        Description copied from interface: IVerifier
        returns current element type. Actual java type depends on the implementation. This method works correctly only when called immediately after handling startElement event.
        Specified by:
        getCurrentElementType in interface IVerifier
        Returns:
        null this method returns null when it doesn't support type-assignment feature, or type-assignment is impossible for the current element (for example due to the ambiguous grammar).
      • localizeMessage

        public static String localizeMessage​(String propertyName,
                                             Object[] args)