Class XapiParser
java.lang.Object
dev.jcputney.elearning.parser.parsers.BaseParser<XapiMetadata,TincanManifest>
dev.jcputney.elearning.parser.parsers.XapiParser
- All Implemented Interfaces:
ModuleParser<TincanManifest>
Parser for xAPI/TinCan packages.
Parses the tincan.xml manifest file and creates XapiMetadata
containing the module information.
The TinCan manifest format is a simple XML structure containing one or more activities with their launch URLs and metadata.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringThe name of the TinCan XML file that contains the module metadata.Fields inherited from class dev.jcputney.elearning.parser.parsers.BaseParser
moduleFileProvider, options, XAPI_JS_FILE, XAPI_SEND_STATEMENT_FILE -
Constructor Summary
ConstructorsConstructorDescriptionXapiParser(FileAccess fileAccess) Constructs an XapiParser with the specified FileAccess instance.XapiParser(FileAccess fileAccess, ParserOptions options) Constructs an XapiParser with the specified FileAccess instance and parser options. -
Method Summary
Modifier and TypeMethodDescriptionprotected XapiMetadataextractMetadata(TincanManifest manifest, ValidationResult validation) Extracts metadata from a parsed and validated manifest.protected Class<TincanManifest>Returns the class type of the TinCan manifest used by this parser.protected StringAbstract method to return the filename of the manifest for the specific parser.protected ValidationResultvalidateManifest(TincanManifest manifest) Validates a parsed manifest and returns validation results.Methods inherited from class dev.jcputney.elearning.parser.parsers.BaseParser
checkForXapi, getModuleType, getOptions, loadExternalMetadataIntoMetadata, parseAndValidate, parseManifest, parseOnly, parseXmlToObject
-
Field Details
-
TINCAN_XML
The name of the TinCan XML file that contains the module metadata.- See Also:
-
-
Constructor Details
-
XapiParser
Constructs an XapiParser with the specified FileAccess instance.- Parameters:
fileAccess- an instance of FileAccess for reading files in the module package
-
XapiParser
Constructs an XapiParser with the specified FileAccess instance and parser options.- Parameters:
fileAccess- an instance of FileAccess for reading files in the module packageoptions- the parser options to control validation and calculation behavior
-
-
Method Details
-
validateManifest
Description copied from class:BaseParserValidates a parsed manifest and returns validation results. Subclasses implement this to use their parser-specific validators.- Specified by:
validateManifestin classBaseParser<XapiMetadata,TincanManifest> - Parameters:
manifest- The parsed manifest to validate- Returns:
- ValidationResult containing any errors or warnings
-
extractMetadata
protected XapiMetadata extractMetadata(TincanManifest manifest, ValidationResult validation) throws ModuleException Description copied from class:BaseParserExtracts metadata from a parsed and validated manifest.- Specified by:
extractMetadatain classBaseParser<XapiMetadata,TincanManifest> - Parameters:
manifest- The parsed manifestvalidation- The validation result (for reference during extraction)- Returns:
- Module-specific metadata
- Throws:
ModuleException- if metadata extraction fails
-
getManifestFileName
Description copied from class:BaseParserAbstract method to return the filename of the manifest for the specific parser.- Specified by:
getManifestFileNamein classBaseParser<XapiMetadata,TincanManifest> - Returns:
- The manifest filename (e.g., "imsmanifest.xml", "cmi5.xml")
-
getManifestClass
Returns the class type of the TinCan manifest used by this parser.- Specified by:
getManifestClassin classBaseParser<XapiMetadata,TincanManifest> - Returns:
- The
Classobject representing theTincanManifesttype.
-