Esempio n. 1
0
    def validate(self):
        """Validate the source XML against the JATS Publishing Schema.

        Returns a tuple comprising the validation status and the errors list.
        """
        result = setdefault(self, '__validation_result', lambda: self.xmlschema.validate(self.lxml))
        errors = setdefault(self, '__validation_errors', lambda: self.xmlschema.error_log)
        return result, errors
Esempio n. 2
0
    def validate(self):
        """Validate the source XML against the JATS Publishing Schema.

        Returns a tuple comprising the validation status and the errors list.
        """
        result = setdefault(self, '__validation_result',
                            lambda: self.xmlschema.validate(self.lxml))
        errors = setdefault(self, '__validation_errors',
                            lambda: self.xmlschema.error_log)
        return result, errors
Esempio n. 3
0
    def _validate_sch(self):
        """Validate the source XML against the SPS Schematron.

        Returns a tuple comprising the validation status and the errors list.
        """
        def make_error_log():
            err_log = self.schematron.error_log
            return [StyleError.from_schematron_errlog(err) for err in err_log]

        result = setdefault(self, '__sch_validation_result', lambda: self.schematron.validate(self.lxml))
        errors = setdefault(self, '__sch_validation_errors', make_error_log)
        return result, errors
Esempio n. 4
0
    def _validate_sch(self):
        """Validate the source XML against the SPS Schematron.

        Returns a tuple comprising the validation status and the errors list.
        """
        def make_error_log():
            err_log = self.schematron.error_log
            return [StyleError.from_schematron_errlog(err) for err in err_log]

        result = setdefault(self, '__sch_validation_result',
                            lambda: self.schematron.validate(self.lxml))
        errors = setdefault(self, '__sch_validation_errors', make_error_log)
        return result, errors
Esempio n. 5
0
    def validate_style(self):
        """Validate the source XML against the SPS Tagging guidelines.

        Returns a tuple comprising the validation status and the errors list.
        """
        def make_error_log():
            errors = next(self.ppl.run(self.lxml, rewrap=True))
            errors += self._validate_sch()[1]
            return errors

        errors = setdefault(self, '__style_validation_result', make_error_log)
        result = setdefault(self, '__style_validation_errors', lambda: not bool(errors))
        return result, errors
Esempio n. 6
0
    def validate_style(self):
        """Validate the source XML against the SPS Tagging guidelines.

        Returns a tuple comprising the validation status and the errors list.
        """
        def make_error_log():
            errors = next(self.ppl.run(self.lxml, rewrap=True))
            errors += self._validate_sch()[1]
            return errors

        errors = setdefault(self, '__style_validation_result', make_error_log)
        result = setdefault(self, '__style_validation_errors',
                            lambda: not bool(errors))
        return result, errors
Esempio n. 7
0
 def validate(self):
     result = setdefault(self, '__validation_result', lambda: self.xmlschema.validate(self.lxml))
     errors = setdefault(self, '__validation_errors', lambda: self.xmlschema.error_log)
     return result, errors