Package com.helger.schematron.svrl
Class SVRLHelper
- java.lang.Object
-
- com.helger.schematron.svrl.SVRLHelper
-
@ThreadSafe public final class SVRLHelper extends Object
Miscellaneous utility methods for handling Schematron output (SVRL).- Author:
- Philip Helger
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static com.helger.commons.collection.impl.ICommonsList<DiagnosticReference>
getAllDiagnosticReferences(FailedAssert aFA)
static com.helger.commons.collection.impl.ICommonsList<DiagnosticReference>
getAllDiagnosticReferences(SuccessfulReport aSR)
static com.helger.commons.collection.impl.ICommonsList<SVRLFailedAssert>
getAllFailedAssertions(SchematronOutputType aSchematronOutput)
Get a list of all failed assertions in a given schematron output.static com.helger.commons.collection.impl.ICommonsList<AbstractSVRLMessage>
getAllFailedAssertionsAndSuccessfulReports(SchematronOutputType aSchematronOutput)
Get a list of all failed assertions and successful reports in a given schematron output.static com.helger.commons.collection.impl.ICommonsList<SVRLFailedAssert>
getAllFailedAssertionsMoreOrEqualSevereThan(SchematronOutputType aSchematronOutput, com.helger.commons.error.level.IErrorLevel aErrorLevel)
Get a list of all failed assertions in a given schematron output, with an error level equally or more severe than the passed error level.static com.helger.commons.collection.impl.ICommonsList<PropertyReference>
getAllPropertyReferences(FailedAssert aFA)
static com.helger.commons.collection.impl.ICommonsList<PropertyReference>
getAllPropertyReferences(SuccessfulReport aSR)
static com.helger.commons.collection.impl.ICommonsList<SVRLSuccessfulReport>
getAllSuccessfulReports(SchematronOutputType aSchematronOutput)
Get a list of all successful reports in a given schematron output.static com.helger.commons.collection.impl.ICommonsList<SVRLSuccessfulReport>
getAllSuccessfulReportsMoreOrEqualSevereThan(SchematronOutputType aSchematronOutput, com.helger.commons.error.level.IErrorLevel aErrorLevel)
Get a list of all successful reports in a given schematron output, with an error level equally or more severe than the passed error level.static String
getAsString(Text aText)
static String
getBeautifiedLocation(String sLocation)
Convert an "unsexy" location string in the for, of*:xx[namespace-uri()='yy']
to something more readable likeprefix:xx
by using the mapping registered in theSVRLLocationBeautifierRegistry
.static String
getBeautifiedLocation(String sLocation, ISVRLLocationBeautifier aLocationBeautifier)
Convert an "unsexy" location string in the for, of*:xx[namespace-uri()='yy']
to something more readable likeprefix:xx
by using the mapping registered in theSVRLLocationBeautifierRegistry
.static ISVRLErrorLevelDeterminator
getErrorLevelDeterminator()
static com.helger.commons.error.level.IErrorLevel
getErrorLevelFromFailedAssert(FailedAssert aFailedAssert)
Get the error level associated with a single failed assertion.static com.helger.commons.error.level.IErrorLevel
getErrorLevelFromSuccessfulReport(SuccessfulReport aSuccessfulReport)
Get the error level associated with a single successful report.static Text
getText(FailedAssert aFA)
static Text
getText(SuccessfulReport aSR)
static void
setErrorLevelDeterminator(ISVRLErrorLevelDeterminator aELD)
Set the global error level determinator.
-
-
-
Method Detail
-
getAllFailedAssertions
@Nonnull @ReturnsMutableCopy public static com.helger.commons.collection.impl.ICommonsList<SVRLFailedAssert> getAllFailedAssertions(@Nullable SchematronOutputType aSchematronOutput)
Get a list of all failed assertions in a given schematron output.- Parameters:
aSchematronOutput
- The schematron output to be used. May benull
.- Returns:
- A non-
null
list with all failed assertions.
-
getAllFailedAssertionsMoreOrEqualSevereThan
@Nonnull @ReturnsMutableCopy public static com.helger.commons.collection.impl.ICommonsList<SVRLFailedAssert> getAllFailedAssertionsMoreOrEqualSevereThan(@Nullable SchematronOutputType aSchematronOutput, @Nonnull com.helger.commons.error.level.IErrorLevel aErrorLevel)
Get a list of all failed assertions in a given schematron output, with an error level equally or more severe than the passed error level.- Parameters:
aSchematronOutput
- The schematron output to be used. May benull
.aErrorLevel
- Minimum error level to be queried- Returns:
- A non-
null
list with all failed assertions.
-
getAllSuccessfulReports
@Nonnull @ReturnsMutableCopy public static com.helger.commons.collection.impl.ICommonsList<SVRLSuccessfulReport> getAllSuccessfulReports(@Nullable SchematronOutputType aSchematronOutput)
Get a list of all successful reports in a given schematron output.- Parameters:
aSchematronOutput
- The schematron output to be used. May benull
.- Returns:
- A non-
null
list with all successful reports.
-
getAllSuccessfulReportsMoreOrEqualSevereThan
@Nonnull @ReturnsMutableCopy public static com.helger.commons.collection.impl.ICommonsList<SVRLSuccessfulReport> getAllSuccessfulReportsMoreOrEqualSevereThan(@Nullable SchematronOutputType aSchematronOutput, @Nonnull com.helger.commons.error.level.IErrorLevel aErrorLevel)
Get a list of all successful reports in a given schematron output, with an error level equally or more severe than the passed error level.- Parameters:
aSchematronOutput
- The schematron output to be used. May benull
.aErrorLevel
- Minimum error level to be queried- Returns:
- A non-
null
list with all successful reports.
-
getAllFailedAssertionsAndSuccessfulReports
@Nonnull @ReturnsMutableCopy public static com.helger.commons.collection.impl.ICommonsList<AbstractSVRLMessage> getAllFailedAssertionsAndSuccessfulReports(@Nullable SchematronOutputType aSchematronOutput)
Get a list of all failed assertions and successful reports in a given schematron output.- Parameters:
aSchematronOutput
- The schematron output to be used. May benull
.- Returns:
- A non-
null
list with all failed assertions and successful reports. Maybe an empty list if the input isnull
.
-
getErrorLevelFromFailedAssert
@Nonnull public static com.helger.commons.error.level.IErrorLevel getErrorLevelFromFailedAssert(@Nonnull FailedAssert aFailedAssert)
Get the error level associated with a single failed assertion.- Parameters:
aFailedAssert
- The failed assert to be queried. May not benull
.- Returns:
- The error level and never
null
.
-
getErrorLevelFromSuccessfulReport
@Nonnull public static com.helger.commons.error.level.IErrorLevel getErrorLevelFromSuccessfulReport(@Nonnull SuccessfulReport aSuccessfulReport)
Get the error level associated with a single successful report.- Parameters:
aSuccessfulReport
- The failed assert to be queried. May not benull
.- Returns:
- The error level and never
null
.
-
getErrorLevelDeterminator
@Nonnull public static ISVRLErrorLevelDeterminator getErrorLevelDeterminator()
- Returns:
- The default error level determinator. May not be
null
.
-
setErrorLevelDeterminator
public static void setErrorLevelDeterminator(@Nonnull ISVRLErrorLevelDeterminator aELD)
Set the global error level determinator.- Parameters:
aELD
- The determinator to use. May not benull
.
-
getBeautifiedLocation
@Nonnull public static String getBeautifiedLocation(@Nonnull String sLocation)
Convert an "unsexy" location string in the for, of*:xx[namespace-uri()='yy']
to something more readable likeprefix:xx
by using the mapping registered in theSVRLLocationBeautifierRegistry
.- Parameters:
sLocation
- The original location string. May not benull
.- Returns:
- The beautified string. Never
null
. Might be identical to the original string if the pattern was not found. - Since:
- 5.0.1
-
getBeautifiedLocation
@Nonnull public static String getBeautifiedLocation(@Nonnull String sLocation, @Nonnull ISVRLLocationBeautifier aLocationBeautifier)
Convert an "unsexy" location string in the for, of*:xx[namespace-uri()='yy']
to something more readable likeprefix:xx
by using the mapping registered in theSVRLLocationBeautifierRegistry
.- Parameters:
sLocation
- The original location string. May not benull
.aLocationBeautifier
- The location beautifier to be used. May not benull
.- Returns:
- The beautified string. Never
null
. Might be identical to the original string if the pattern was not found. - Since:
- 6.0.4
-
getAllDiagnosticReferences
@Nonnull public static com.helger.commons.collection.impl.ICommonsList<DiagnosticReference> getAllDiagnosticReferences(@Nonnull FailedAssert aFA)
-
getAllPropertyReferences
@Nonnull public static com.helger.commons.collection.impl.ICommonsList<PropertyReference> getAllPropertyReferences(@Nonnull FailedAssert aFA)
-
getText
@Nonnull public static Text getText(@Nonnull FailedAssert aFA)
-
getAllDiagnosticReferences
@Nonnull public static com.helger.commons.collection.impl.ICommonsList<DiagnosticReference> getAllDiagnosticReferences(@Nonnull SuccessfulReport aSR)
-
getAllPropertyReferences
@Nonnull public static com.helger.commons.collection.impl.ICommonsList<PropertyReference> getAllPropertyReferences(@Nonnull SuccessfulReport aSR)
-
getText
@Nonnull public static Text getText(@Nonnull SuccessfulReport aSR)
-
-