use of com.helger.schematron.pure.errorhandler.WrappedCollectingPSErrorHandler in project phive by phax.
the class ValidationExecutorSchematron method _createSchematronResource.
@Nonnull
private AbstractSchematronResource _createSchematronResource(@Nullable final Locale aLocale, @Nonnull final ErrorList aErrorList, @Nonnull final Consumer<ESchematronOutput> aSpecialOutputHdl) {
final IValidationArtefact aArtefact = getValidationArtefact();
// get the Schematron resource to be used for this validation artefact
final IReadableResource aSCHRes = aArtefact.getRuleResource();
final IValidationType aVT = aArtefact.getValidationArtefactType();
if (aVT == EValidationType.SCHEMATRON_PURE) {
final SchematronResourcePure aPureSCH = new SchematronResourcePure(aSCHRes);
aPureSCH.setErrorHandler(new WrappedCollectingPSErrorHandler(aErrorList));
// consecutive calls!
return aPureSCH;
}
if (aVT == EValidationType.SCHEMATRON_SCH) {
final SchematronResourceSCH aSCHSCH = new SchematronResourceSCH(aSCHRes);
aSCHSCH.setErrorListener(new WrappedCollectingTransformErrorListener(aErrorList));
if (aLocale != null && StringHelper.hasText(aLocale.getLanguage()))
aSCHSCH.setLanguageCode(aLocale.getLanguage());
return aSCHSCH;
}
if (aVT == EValidationType.SCHEMATRON_SCHXSLT) {
final SchematronResourceSchXslt_XSLT2 aSCHSCH = new SchematronResourceSchXslt_XSLT2(aSCHRes);
aSCHSCH.setErrorListener(new WrappedCollectingTransformErrorListener(aErrorList));
if (aLocale != null && StringHelper.hasText(aLocale.getLanguage()))
aSCHSCH.setLanguageCode(aLocale.getLanguage());
return aSCHSCH;
}
if (aVT == EValidationType.SCHEMATRON_XSLT) {
final SchematronResourceXSLT aSCHXSLT = new SchematronResourceXSLT(aSCHRes);
aSCHXSLT.setErrorListener(new WrappedCollectingTransformErrorListener(aErrorList));
return aSCHXSLT;
}
if (aVT == EValidationType.SCHEMATRON_OIOUBL) {
final SchematronResourceXSLT aSCHXSLT = new SchematronResourceXSLT(aSCHRes);
aSCHXSLT.setErrorListener(new WrappedCollectingTransformErrorListener(aErrorList));
// Special output layout
aSpecialOutputHdl.accept(ESchematronOutput.OIOUBL);
return aSCHXSLT;
}
throw new IllegalStateException("Unsupported Schematron validation type: " + aVT);
}
Aggregations