public void parseManifest(string pathToManifest) { string XMLPath = pathToManifest; string XMLDirectory = System.IO.Path.GetDirectoryName(pathToManifest); if (!System.IO.File.Exists(XMLPath)) { logger.LogWarning("Manifest file not found!"); } adlcp_rootv1p2Doc doc = new adlcp_rootv1p2Doc(); adlcp_rootv1p2.imscp.manifestType root = new adlcp_rootv1p2.imscp.manifestType(doc.Load(XMLPath)); this.identifier = root.identifier.Value; // SCORM version should be in the metadata. It should have the following values: // Schema: ADL SCORM // SchemaVersion: 1.2 // for SCORM2004 it will say "1.3" or "CAM 1.3" // unfortunately I have seen a lot of manifests without this which forces you to guess if (root.Hasmetadata()) { adlcp_metadataType meta = root.Getmetadata(); if (meta.Hasschemaversion()) { // this is the way we SHOULD get the version but some manifests don't have this SCORM_Version = meta.schemaversion.Value; } } if (SCORM_Version == string.Empty || SCORM_Version == null) { SCORM_Version = this.GetSCORMVersion(root); //backwards way to get the version } if (SCORM_Version == "1.2") { logger.LogInformation("Module is SCORM 1.2"); adlcp_rootv1p2.imscp.versionType versionType; if (root.Hasversion()) { versionType = root.Getversion(); // this is the manifest's creator's version of this manifest, not SCORM version } else { versionType = new adlcp_rootv1p2.imscp.versionType("1.0"); } version = versionType.Value; title = identifier; //this will become the course title unless there is one in Organizations (should be!) if (root.Hasmetadata()) { adlcp_metadataType md = root.Getmetadata(); if (md.HasLOM()) { if (md.LOM.Hasgeneral()) { if (md.LOM.general.Hasdescription()) { description = md.LOM.general.description.ToString(); } } } } href = FindDefaultWebPage(root); } // end if version == 1.2 else if (SCORM_Version == "1.3" || SCORM_Version == "CAM 1.3" || SCORM_Version.IndexOf("2004") >= 0) { logger.LogInformation("Module is SCORM2004"); adlcp_v1p3Doc doc2 = new adlcp_v1p3Doc(); manifestTypeExtended root2 = new manifestTypeExtended(doc2.Load(XMLPath)); identifier = root.Getidentifier().Value; title = identifier; version = root.Getversion().Value; // Now we start looking for the default web page. Organizations => organization => item // get the identifierref for the first item // then find that identifier in resources => resource. That resource.href is the default launching page for the sco // get all organizations for this manifest. "Organizations" is a container for "Organization" objects // href = FindDefaultWebPage(root); } else { logger.LogInformation("Manifest version is " + SCORM_Version + ". Must be 1.2 or 1.3"); return; } logger.LogInformation("Parse of manifest completed successfully"); return; }
public void InsertversionAt(versionType newValue, int index) { InsertDomChildAt(NodeType.Attribute, "", "version", index, newValue.ToString()); }
public void ReplaceversionAt(versionType newValue, int index) { ReplaceDomChildAt(NodeType.Attribute, "", "version", index, newValue.ToString()); }
public void Addversion(versionType newValue) { AppendDomChild(NodeType.Attribute, "", "version", newValue.ToString()); }