kitodo-presentation icon indicating copy to clipboard operation
kitodo-presentation copied to clipboard

[FEATURE] General reusable validation implementation and middleware for validating DOMDocument

Open markusweigelt opened this issue 1 year ago • 0 comments

This PR provides abstract classes to derived from for custom validation and reusable implementations for validation of DOMDocument.

  • Abstract validator and validation stack from which it can be derived (Can be handled as standalone validators as well, since they are derived from the AbstractValidator of Extbase)
  • Implementation and tests of DOMDocumentValidationStack, XMLSchemesValidator and SaxonXslToSvrlValidator
  • Comprehensive documentation
  • Customisable DOMDocumentValidation middleware via TypoScript setting domDocumentValidationValidators

Example of middleware

URI Query: dlf/domDocumentValidation&url=https%3A%2F%2Fwww.example.com%2Fmetsmods.xml

JSON response

{
  "valid": false,
  "results": {
    "XML-Schemes Validator": [
      "Element '{http://www.loc.gov/METS/}mdWrap', attribute 'MDTYP': The attribute 'MDTYP' is not allowed.\n",
      "Element '{http://www.loc.gov/METS/}mdWrap': The attribute 'MDTYPE' is required but missing.\n"
    ],
    ...
  }
}

markusweigelt avatar Aug 26 '24 17:08 markusweigelt