Package name.jurgenei.gradle.xml
Class SchematronTask
java.lang.Object
org.gradle.api.internal.AbstractTask
org.gradle.api.DefaultTask
org.gradle.api.internal.ConventionTask
org.gradle.api.tasks.SourceTask
name.jurgenei.gradle.xml.AbstractXmlValidationTask
name.jurgenei.gradle.xml.SchematronTask
- All Implemented Interfaces:
Comparable<org.gradle.api.Task>,ValidationTaskSpec,org.gradle.api.internal.DynamicObjectAware,org.gradle.api.internal.IConventionAware,org.gradle.api.internal.TaskInternal,org.gradle.api.Named,org.gradle.api.plugins.ExtensionAware,org.gradle.api.Task,org.gradle.api.tasks.util.PatternFilterable,org.gradle.util.Configurable<org.gradle.api.Task>
@DisableCachingByDefault(because="Schematron compilation and validation depends on external schema files")
public abstract class SchematronTask
extends AbstractXmlValidationTask
Validates XML files via Schematron by compiling .sch to XSLT and producing SVRL output.
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.gradle.api.Named
org.gradle.api.Named.Namer -
Field Summary
Fields inherited from interface org.gradle.api.Task
TASK_ACTION, TASK_CONSTRUCTOR_ARGS, TASK_DEPENDS_ON, TASK_DESCRIPTION, TASK_GROUP, TASK_NAME, TASK_OVERWRITE, TASK_TYPE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract org.gradle.api.provider.Property<Boolean> SchXslt transpiler parameterschxslt:check-assembled-schema.abstract org.gradle.api.provider.Property<Boolean> SchXslt transpiler parameterschxslt:compact-report.abstract org.gradle.api.provider.Property<Boolean> getDebug()SchXslt transpiler parameterschxslt:debug.abstract org.gradle.api.provider.Property<String> SchXslt transpiler parameterschxslt:default-from.abstract org.gradle.api.provider.Property<String> SchXslt transpiler parameterschxslt:default-severity.abstract org.gradle.api.provider.Property<Boolean> SchXslt transpiler parameterschxslt:expand-text.abstract org.gradle.api.provider.Property<Boolean> SchXslt transpiler parameterschxslt:fail-early.abstract org.gradle.api.provider.Property<Boolean> SchXslt transpiler parameterschxslt:handle-dynamic-errors.abstract org.gradle.api.provider.Property<String> SchXslt transpiler parameterschxslt:location-function.abstract org.gradle.api.provider.Property<String> getPhase()SchXslt transpiler parameterschxslt:phase.abstract org.gradle.api.provider.Property<Boolean> SchXslt transpiler parameterschxslt:report-active-pattern.abstract org.gradle.api.provider.Property<Boolean> SchXslt transpiler parameterschxslt:report-fired-rule.abstract org.gradle.api.provider.Property<Boolean> SchXslt transpiler parameterschxslt:report-skipped-assertion.abstract org.gradle.api.provider.Property<Boolean> SchXslt transpiler parameterschxslt:report-suppressed-rule.abstract org.gradle.api.file.RegularFilePropertyReturns the Schematron rules file used for validation.abstract org.gradle.api.provider.Property<String> SchXslt transpiler parameterschxslt:severity-threshold.abstract org.gradle.api.provider.Property<Boolean> SchXslt transpiler parameterschxslt:streamable.abstract org.gradle.api.file.RegularFilePropertygetStyle()Optional destination for a compiled Schematron stylesheet.abstract org.gradle.api.provider.Property<Boolean> SchXslt transpiler parameterschxslt:terminate-validation-on-error.abstract org.gradle.api.file.RegularFilePropertyReturns an optional override for the bundled SchXslt transpiler stylesheet.voidSets the Schematron schema file using Gradle file notation.voidSets the compiled Schematron stylesheet output location.voidtranspilerStylesheet(Object path) Sets a custom transpiler stylesheet.protected ValidationResultValidates a single input file and returns normalized findings.Methods inherited from class name.jurgenei.gradle.xml.AbstractXmlValidationTask
fileset, getFailOnError, getJunitOutputDir, getJunitSuiteName, getMaxFailures, getOutputDir, getOutputExtension, getParams, getReportFormat, getSource, getWorkers, param, validateAllMethods inherited from class org.gradle.api.tasks.SourceTask
exclude, exclude, exclude, exclude, getExcludes, getIncludes, getPatternSet, getPatternSetFactory, include, include, include, include, setExcludes, setIncludes, setSource, setSource, sourceMethods inherited from class org.gradle.api.internal.ConventionTask
conventionMapping, conventionMapping, getConventionMappingMethods inherited from class org.gradle.api.DefaultTask
compareTo, configure, dependsOn, doFirst, doFirst, doFirst, doLast, doLast, doLast, finalizedBy, getActions, getAnt, getDependsOn, getDescription, getDestroyables, getDidWork, getEnabled, getExtensions, getFinalizedBy, getGroup, getInputs, getLocalState, getLogger, getLogging, getMustRunAfter, getName, getOutputs, getPath, getProject, getShouldRunAfter, getState, getTaskDependencies, getTemporaryDir, getTimeout, hasProperty, mustRunAfter, onlyIf, onlyIf, onlyIf, property, setActions, setDependsOn, setDescription, setDidWork, setEnabled, setFinalizedBy, setGroup, setMustRunAfter, setOnlyIf, setOnlyIf, setOnlyIf, setProperty, setShouldRunAfter, shouldRunAfter, usesServiceMethods inherited from class org.gradle.api.internal.AbstractTask
acceptServiceReferences, appendParallelSafeAction, doNotTrackState, doNotTrackStateIf, getAsDynamicObject, getIdentityPath, getImpliesSubProjects, getLifecycleDependencies, getOnlyIf, getReasonNotToTrackState, getReasonsNotToTrackState, getReasonTaskIsIncompatibleWithConfigurationCache, getRequiredServices, getServices, getSharedResources, getStandardOutputCapture, getTaskActions, getTaskIdentity, getTemporaryDirFactory, hasTaskActions, injectIntoNewInstance, isCompatibleWithConfigurationCache, isEnabled, isHasCustomActions, notCompatibleWithConfigurationCache, prependParallelSafeAction, restoreOnlyIf, restoreTaskActions, setImpliesSubProjectsMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.gradle.api.Task
doNotTrackState, notCompatibleWithConfigurationCache
-
Constructor Details
-
SchematronTask
public SchematronTask()Creates a Schematron validation task.
-
-
Method Details
-
getSchema
@InputFile @PathSensitive(RELATIVE) public abstract org.gradle.api.file.RegularFileProperty getSchema()Returns the Schematron rules file used for validation.- Returns:
- Schematron schema file used for validation
-
getTranspilerStylesheet
@Optional @InputFile @PathSensitive(RELATIVE) public abstract org.gradle.api.file.RegularFileProperty getTranspilerStylesheet()Returns an optional override for the bundled SchXslt transpiler stylesheet.- Returns:
- optional transpiler stylesheet overriding bundled SchXslt transpiler
-
getStyle
@Optional @OutputFile public abstract org.gradle.api.file.RegularFileProperty getStyle()Optional destination for a compiled Schematron stylesheet.When set, the task reuses this file and recompiles only when needed based on schema/transpiler timestamps and transpiler-parameter fingerprint changes.
- Returns:
- optional compiled stylesheet location
-
getDebug
SchXslt transpiler parameterschxslt:debug. Enable or disable debugging. When debugging is enable, the validation stylesheet is indented. Defaults to false.- Returns:
- optional debug flag
-
getPhase
SchXslt transpiler parameterschxslt:phase. Name of the validation phase. The value '#DEFAULT' selects the pattern in thesch:schema/@defaultPhaseattribute or '#ALL' if this attribute is not present. The value '#ALL' selects all patterns. Defaults to '#DEFAULT'.- Returns:
- optional validation phase
-
getExpandText
SchXslt transpiler parameterschxslt:expand-text. When set to boolean true, the validation stylesheet globally enables text value templates and you may use them in assertion or diagnostic messages. Defaults to false.- Returns:
- optional expand-text flag
-
getStreamable
SchXslt transpiler parameterschxslt:streamable. Set to boolean true to create a streamable validation stylesheet. This does not check the streamability of XPath expressions in rules, assertions, variables etc. It merely declares the modes in the validation stylesheet to be streamable and removes the@locationattribute from the SVRL output when no location function is given because the defaultfn:path()is not streamable. Defaults to false.- Returns:
- optional streamable flag
-
getLocationFunction
SchXslt transpiler parameterschxslt:location-function. Name of a functionf($context as node()) as xs:stringthat provides location information for the SVRL report. Defaults tofn:path()when not set.- Returns:
- optional location function name
-
getFailEarly
SchXslt transpiler parameterschxslt:fail-early. When set to boolean true, the validation stylesheet stops as soon as it encounters the first failed assertion or successful report. Defaults to false.- Returns:
- optional fail-early flag
-
getTerminateValidationOnError
@Optional @Input public abstract org.gradle.api.provider.Property<Boolean> getTerminateValidationOnError()SchXslt transpiler parameterschxslt:terminate-validation-on-error. When set to boolean true, the validation stylesheet terminates the XSLT processor when it encounters a dynamic error. Defaults to true.- Returns:
- optional terminate-on-error flag
-
getReportActivePattern
SchXslt transpiler parameterschxslt:report-active-pattern. When set to boolean true, the validation stylesheet reports active patterns and groups. Defaults to true.- Returns:
- optional report-active-pattern flag
-
getReportFiredRule
SchXslt transpiler parameterschxslt:report-fired-rule. When set to boolean true, the validation stylesheet reports fired rules. Defaults to true.- Returns:
- optional report-fired-rule flag
-
getReportSuppressedRule
@Optional @Input public abstract org.gradle.api.provider.Property<Boolean> getReportSuppressedRule()SchXslt transpiler parameterschxslt:report-suppressed-rule. When set to boolean true, the validation stylesheet reports suppressed rules. Defaults to true.- Returns:
- optional report-suppressed-rule flag
-
getReportSkippedAssertion
@Optional @Input public abstract org.gradle.api.provider.Property<Boolean> getReportSkippedAssertion()SchXslt transpiler parameterschxslt:report-skipped-assertion. When set to boolean true, the validation stylesheet reports assertions that are skipped. Defaults to true.- Returns:
- optional report-skipped-assertion flag
-
getCompactReport
SchXslt transpiler parameterschxslt:compact-report. When set to boolean true, the validation stylesheet only reports failed assertions, successful reports and errors. Defaults to false.- Returns:
- optional compact-report flag
-
getSeverityThreshold
SchXslt transpiler parameterschxslt:severity-threshold. Assertions with a severity lesser than the threshold are not checked. One of 'info', 'warning', 'error', or 'fatal'. Defaults to 'info'.- Returns:
- optional severity threshold
-
getDefaultSeverity
SchXslt transpiler parameterschxslt:default-severity. Severity of assertions without an@severityattribute. One of 'info', 'warning', 'error', or 'fatal'. Defaults to 'fatal'.- Returns:
- optional default severity
-
getDefaultFrom
SchXslt transpiler parameterschxslt:default-from. Default value of the expression that selects the subset of the document to be validate. Can be overwritten on a per-phase basis by the@fromattribute. The default from expression also applies to the phase '#ALL'. Defaults to 'root()'.- Returns:
- optional default from expression
-
getCheckAssembledSchema
@Optional @Input public abstract org.gradle.api.provider.Property<Boolean> getCheckAssembledSchema()SchXslt transpiler parameterschxslt:check-assembled-schema. When set to boolean true, the transpiler performs some plausability checks after all external definitions are included. It terminates with an error if it finds errors in the assembled schema. Defaults to false.- Returns:
- optional check-assembled-schema flag
-
getHandleDynamicErrors
SchXslt transpiler parameterschxslt:handle-dynamic-errors. When set to boolean true, the validation stylesheet writes dynamic errors as asvrl:errorelement to the validation report and terminates with aschxslt:ValidationErrorerror. When set to false, dynamic errors bubble up to the XSLT processor. Defaults to true.- Returns:
- optional handle-dynamic-errors flag
-
schema
Sets the Schematron schema file using Gradle file notation.- Parameters:
path- file notation accepted byProject.file
-
transpilerStylesheet
Sets a custom transpiler stylesheet.- Parameters:
path- file notation accepted byProject.file
-
style
Sets the compiled Schematron stylesheet output location.- Parameters:
path- file notation accepted byProject.file
-
validate
Description copied from class:AbstractXmlValidationTaskValidates a single input file and returns normalized findings.- Specified by:
validatein classAbstractXmlValidationTask- Parameters:
inputFile- file to validateparams- task-level validation parameters- Returns:
- normalized validation result
- Throws:
Exception- when validation cannot be performed
-