Class Scorm2004SchemaValidator

java.lang.Object
dev.jcputney.elearning.parser.input.common.serialization.Scorm2004SchemaValidator

public final class Scorm2004SchemaValidator extends Object
Utility for validating SCORM 2004 imsmanifest.xml against local XSDs.

Validation is optional and disabled by default. Enable it by setting the system property elearning.parser.scorm2004.validateXsd=true or the environment variable ELEARNING_SCORM2004_VALIDATE_XSD=true.

  • Method Summary

    Modifier and Type
    Method
    Description
    static boolean
    Determines whether validation is enabled based on system properties or environment variables.
    static void
    validate(byte[] manifestXml)
    Validates the provided manifest XML bytes against local SCORM 2004 XSDs.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • isEnabled

      public static boolean isEnabled()
      Determines whether validation is enabled based on system properties or environment variables.

      The method first checks the system property corresponding to VALIDATE_SYSPROP. If a value is found, it converts it to a boolean and returns the result. If the system property is not set, it then checks the environment variable corresponding to VALIDATE_ENV and converts it to a boolean.

      Returns:
      true if validation is enabled based on the corresponding system property or environment variable; otherwise false.
    • validate

      public static void validate(byte[] manifestXml) throws SAXException, IOException
      Validates the provided manifest XML bytes against local SCORM 2004 XSDs.
      Parameters:
      manifestXml - The XML document bytes
      Throws:
      SAXException - when validation fails with details
      IOException - when reading schema resources fails