Class Cmi5Parser

All Implemented Interfaces:
ModuleParser<Cmi5Manifest>

public final class Cmi5Parser extends BaseParser<Cmi5Metadata,Cmi5Manifest>
Cmi5Parser is responsible for parsing cmi5-specific metadata from the cmi5.xml file.

The "cmi5" xAPI-based specification includes Assignable Units (AUs) as discrete learning objects with metadata for LMS tracking and reporting. This parser extracts metadata such as the title, launch URL, prerequisites, dependencies, detailed AU information, and custom metadata.

  • Field Details

    • CMI5_XML

      public static final String CMI5_XML
      The name of the cmi5 XML file that contains the module metadata.
      See Also:
  • Constructor Details

    • Cmi5Parser

      public Cmi5Parser(FileAccess fileAccess)
      Constructs a Cmi5Parser with the specified FileAccess instance.
      Parameters:
      fileAccess - An instance of FileAccess for reading files in the module package.
    • Cmi5Parser

      public Cmi5Parser(FileAccess fileAccess, ParserOptions options)
      Constructs a Cmi5Parser with the specified FileAccess instance and parser options.
      Parameters:
      fileAccess - An instance of FileAccess for reading files in the module package.
      options - The parser options to control validation and calculation behavior.
  • Method Details

    • validate

      public ValidationResult validate()
      Validates the cmi5 module without fully parsing it. This method provides efficient validation by only parsing the manifest file and running structural validation checks.
      Specified by:
      validate in interface ModuleParser<Cmi5Manifest>
      Overrides:
      validate in class BaseParser<Cmi5Metadata,Cmi5Manifest>
      Returns:
      ValidationResult containing any errors or warnings found
    • parse

      public Cmi5Metadata parse() throws ModuleException
      Parses the cmi5 module located at the specified modulePath.

      This method reads the cmi5.xml file to extract metadata such as the title, launch URL, prerequisites, dependencies, list of Assignable Units (AUs), and custom data for LMS tracking. Since cmi5 is always xAPI-enabled, the isXapiEnabled flag is set to true for all cmi5 modules.

      Specified by:
      parse in interface ModuleParser<Cmi5Manifest>
      Specified by:
      parse in class BaseParser<Cmi5Metadata,Cmi5Manifest>
      Returns:
      A Cmi5Metadata object containing the parsed metadata.
      Throws:
      ModuleParsingException - If the module's manifest cannot be parsed or if required fields are missing.
      ModuleException - If the module type can't be determined or there's an error parsing.
    • getManifestClass

      protected Class<Cmi5Manifest> getManifestClass()
      Returns the class type of the Cmi5 manifest used by this parser.
      Specified by:
      getManifestClass in class BaseParser<Cmi5Metadata,Cmi5Manifest>
      Returns:
      The Class object representing the Cmi5Manifest type.