Skip to content
Snippets Groups Projects
Commit f62dc41e authored by Andreas Romeyke's avatar Andreas Romeyke
Browse files

- enhanced with nonvalidating

parent 4e8e79a5
Branches
Tags
No related merge requests found
Pipeline #4402 failed
......@@ -16,5 +16,5 @@ limitations under the License.
package org.slub.rosetta.dps.repository.plugin;
public enum ValidationSchemaType {
schema, dtd, relaxng, schematron, nothing
schema, dtd, relaxng, schematron, nonvalidating, nothing,
}
......@@ -98,6 +98,7 @@ public class XmlFormatValidationPlugin implements FormatValidationPlugin {
case "schema" -> schematype = ValidationSchemaType.schema;
case "schematron" -> schematype = ValidationSchemaType.schematron;
case "relaxng" -> schematype = ValidationSchemaType.relaxng;
case "nonvalidating" -> schematype = ValidationSchemaType.nonvalidating;
default -> validationLogger.error("attribute schematype needs to be type of schema, schematron or relaxng, but is " + attr_type);
}
URI uri;
......@@ -261,24 +262,32 @@ public class XmlFormatValidationPlugin implements FormatValidationPlugin {
case dtd -> {
ValidateDTD validator = new ValidateDTD(validationCatalogResolver, validationErrorHandler, validationLogger);
valid = validator.validateAgainst(filePath);
break;
}
case schema -> {
ValidateSchema validator = new ValidateSchema(validationResourceResolver, validationLogger);
valid = validator.validateFormatAgainstSchemaRecursively(doc, validationSchema);
}
case nonvalidating -> {
ValidateSchema validator = new ValidateSchema(validationResourceResolver, validationLogger);
valid = validator.validateFormatAgainstSchemaRecursively(doc, validationSchema);
}
case relaxng -> {
ValidateRelaxNG validator = new ValidateRelaxNG(validationErrorHandler, validationLogger);
valid = validator.validateAgainst(doc, validationSchema.schemaURI);
break;
}
case schematron -> {
ValidateSchematron validator = new ValidateSchematron();
valid = validator.validateAgainst(doc, validationSchema.schemaURI);
validationLogger.error("unsupported schematron schema uri=" + validationSchema.schemaURI + " of type: " + validationSchema.schemaType);
valid = false;
break;
}
default -> {
validationLogger.error("unsupported schema uri=" + validationSchema.schemaURI + " of type: " + validationSchema.schemaType);
valid = false;
break;
}
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment