Class SchematronHelper

java.lang.Object
com.helger.schematron.SchematronHelper

@Immutable public final class SchematronHelper extends Object
This is a helper class that provides a way to easily apply an Schematron resource on an XML resource.
Author:
Philip Helger
  • Method Details

    • isDeprecatedSchematronNS

      public static boolean isDeprecatedSchematronNS(@Nullable String sNamespaceURI)
      Check if the passed namespace URI is deprecated.
      Parameters:
      sNamespaceURI - The namespace URI to check. May be null.
      Returns:
      true if the passed namespace URI is a deprecated Schematron namespace URI, false if not.
      Since:
      5.4.1
    • isValidSchematronNS

      public static boolean isValidSchematronNS(@Nullable String sNamespaceURI, boolean bLenient)
      Check if the passed namespace URI is supported.
      Parameters:
      sNamespaceURI - The namespace URI to check. May be null.
      bLenient - true to support old namespace URIs, false if not.
      Returns:
      true if the passed namespace URI is a valid Schematron namespace URI, false if not.
      Since:
      5.4.1
    • getAllValidSchematronNS

      @Nonnull @Nonempty @ReturnsMutableCopy public static com.helger.commons.collection.impl.ICommonsList<String> getAllValidSchematronNS(boolean bLenient)
      Get a list of all supported namespaces.
      Parameters:
      bLenient - true to support old namespace URIs, false if not.
      Returns:
      The non-null and non-empty list of all supported schematron namespace URIs.
      Since:
      5.4.1
    • convertToErrorList

      @Nonnull public static com.helger.commons.error.list.IErrorList convertToErrorList(@Nonnull SchematronOutputType aSchematronOutput, @Nullable String sResourceName)
      Convert a SchematronOutputType to an IErrorList.
      Parameters:
      aSchematronOutput - The result of Schematron validation
      sResourceName - The name of the resource that was validated (may be a file path etc.)
      Returns:
      List non-null error list of SVRLResourceError objects.
    • getWithResolvedSchematronIncludes

      @Nullable public static com.helger.xml.microdom.IMicroDocument getWithResolvedSchematronIncludes(@Nonnull com.helger.commons.io.resource.IReadableResource aResource, @Nonnull ISchematronErrorHandler aErrorHandler)
      Resolve all Schematron includes of the passed resource.
      Parameters:
      aResource - The Schematron resource to read. May not be null.
      aErrorHandler - The error handler to be used. May not be null.
      Returns:
      null if the passed resource could not be read as XML document
    • getWithResolvedSchematronIncludes

      @Nullable public static com.helger.xml.microdom.IMicroDocument getWithResolvedSchematronIncludes(@Nonnull com.helger.commons.io.resource.IReadableResource aResource, @Nullable com.helger.xml.serialize.read.ISAXReaderSettings aSettings, @Nonnull ISchematronErrorHandler aErrorHandler)
      Resolve all Schematron includes of the passed resource.
      Parameters:
      aResource - The Schematron resource to read. May not be null.
      aSettings - The SAX reader settings to be used. May be null to use the default settings.
      aErrorHandler - The error handler to be used. May not be null.
      Returns:
      null if the passed resource could not be read as XML document
    • getWithResolvedSchematronIncludes

      @Nullable public static com.helger.xml.microdom.IMicroDocument getWithResolvedSchematronIncludes(@Nonnull com.helger.commons.io.resource.IReadableResource aResource, @Nullable com.helger.xml.serialize.read.ISAXReaderSettings aSettings, @Nonnull ISchematronErrorHandler aErrorHandler, boolean bLenient)
      Resolve all Schematron includes of the passed resource.
      Parameters:
      aResource - The Schematron resource to read. May not be null.
      aSettings - The SAX reader settings to be used. May be null to use the default settings.
      aErrorHandler - The error handler to be used. May not be null.
      bLenient - true if 'old' Schematron NS is tolerated.
      Returns:
      null if the passed resource could not be read as XML document
      Since:
      5.4.1