Class SVRLHelper


  • @ThreadSafe
    public final class SVRLHelper
    extends Object
    Miscellaneous utility methods for handling Schematron output (SVRL).
    Author:
    Philip Helger
    • 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 be null.
        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 be null.
        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 be null.
        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 be null.
        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 be null.
        Returns:
        A non-null list with all failed assertions and successful reports. Maybe an empty list if the input is null.
      • 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 be null.
        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 be null.
        Returns:
        The error level and never null.
      • setErrorLevelDeterminator

        public static void setErrorLevelDeterminator​(@Nonnull
                                                     ISVRLErrorLevelDeterminator aELD)
        Set the global error level determinator.
        Parameters:
        aELD - The determinator to use. May not be null.
      • 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 like prefix:xx by using the mapping registered in the SVRLLocationBeautifierRegistry.
        Parameters:
        sLocation - The original location string. May not be null.
        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 like prefix:xx by using the mapping registered in the SVRLLocationBeautifierRegistry.
        Parameters:
        sLocation - The original location string. May not be null.
        aLocationBeautifier - The location beautifier to be used. May not be null.
        Returns:
        The beautified string. Never null. Might be identical to the original string if the pattern was not found.
        Since:
        6.0.4