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

- refactoring, replaced if-then-elsif... with switch-case

parent 7c12f1b8
No related branches found
No related tags found
No related merge requests found
......@@ -348,27 +348,28 @@ public class SLUBXmlFormatValidationPlugin implements FormatValidationPlugin {
reportDetail("assigned schema uri: " + validationSchema.schemaURI);
var schemaType = validationSchema.schemaType;
Document doc = getDocument(filePath);
if (schemaType == ValidationSchemaType.dtd) {
switch (schemaType) {
case dtd -> {
SLUBValidateDTD validator = new SLUBValidateDTD(validationCatalogResolver, validationErrorHandler);
valid = validator.validateAgainst(filePath);
}
else if (schemaType == ValidationSchemaType.relaxng) {
case schema -> validateFormatAgainstSchemaRecursively(doc, validationSchema);
case relaxng -> {
SLUBValidateRelaxNG validator = new SLUBValidateRelaxNG();
valid = validator.validateAgainst(doc, validationSchema.schemaURI);
} else if (schemaType == ValidationSchemaType.schematron) {
}
case schematron -> {
SLUBValidateSchematron validator = new SLUBValidateSchematron();
valid = validator.validateAgainst(doc, validationSchema.schemaURI);
reportError("unsupported schematron schema uri=" + validationSchema.schemaURI + " of type: " + validationSchema.schemaType);
valid = false;
/* */
} else if (schemaType == ValidationSchemaType.schema) {
validateFormatAgainstSchemaRecursively(doc, validationSchema);
} else {
}
default -> {
reportError("unsupported schema uri=" + validationSchema.schemaURI + " of type: " + validationSchema.schemaType);
valid = false;
}
}
}
private ValidationSchemaType checkIfDtdIsApplicable(Document doc) {
......@@ -409,10 +410,8 @@ public class SLUBXmlFormatValidationPlugin implements FormatValidationPlugin {
//dbf.setXIncludeAware(true);
dbf.setNamespaceAware(true);
DocumentBuilder db = dbf.newDocumentBuilder();
db.setErrorHandler( validationErrorHandler );
//db.setEntityResolver(validationCatalogResolver);
if (debug) System.out.println(
"DOCUMENT LOADER: ns aware=" + db.isNamespaceAware()
+ " include aware=" + db.isXIncludeAware()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment