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 Class<TincanManifest>Returns the class type of the TinCan manifest used by this parser.parse()Parses the xAPI/TinCan manifest.validate()Validates the xAPI/TinCan module without fully parsing it.Methods inherited from class dev.jcputney.elearning.parser.parsers.BaseParser
checkForXapi, getOptions, loadExternalMetadataIntoMetadata, parseManifest, 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
-
validate
Validates the xAPI/TinCan module without fully parsing it. This method provides efficient validation by only parsing the manifest file and running structural validation checks.- Specified by:
validatein interfaceModuleParser<TincanManifest>- Overrides:
validatein classBaseParser<XapiMetadata,TincanManifest> - Returns:
- ValidationResult containing any errors or warnings found
-
parse
Parses the xAPI/TinCan manifest.- Specified by:
parsein interfaceModuleParser<TincanManifest>- Specified by:
parsein classBaseParser<XapiMetadata,TincanManifest> - Returns:
- the parsed xAPI metadata
- Throws:
ModuleParsingException- if parsing failsModuleException- If the module type can't be determined or there's an error parsing.
-
getManifestClass
Returns the class type of the TinCan manifest used by this parser.- Specified by:
getManifestClassin classBaseParser<XapiMetadata,TincanManifest> - Returns:
- The
Classobject representing theTincanManifesttype.
-