Next / Previous / Contents / Shipman's homepage

15.6. RelaxValidator.validate()

This method passes the ElementTree to the .validate() method of the stored RelaxNG instance, which returns a bool value, True iff the tree is valid. We translate a False return value to an exception.

rnc_validate.py
# - - -   R e l a x V a l i d a t o r . v a l i d a t e

    def validate(self, tree):
        '''Validate tree against self.
        '''
        if not self.__schema.validate(tree):
            raise RelaxException(self.__schema.error_log)