AndcultureCode.CommonCartridge.Parser
1.0.9
dotnet add package AndcultureCode.CommonCartridge.Parser --version 1.0.9
NuGet\Install-Package AndcultureCode.CommonCartridge.Parser -Version 1.0.9
<PackageReference Include="AndcultureCode.CommonCartridge.Parser" Version="1.0.9" />
paket add AndcultureCode.CommonCartridge.Parser --version 1.0.9
#r "nuget: AndcultureCode.CommonCartridge.Parser, 1.0.9"
// Install AndcultureCode.CommonCartridge.Parser as a Cake Addin
#addin nuget:?package=AndcultureCode.CommonCartridge.Parser&version=1.0.9
// Install AndcultureCode.CommonCartridge.Parser as a Cake Tool
#tool nuget:?package=AndcultureCode.CommonCartridge.Parser&version=1.0.9
Common Cartridge Dotnet core parser
Dotnet Core Package for parsing LTI & Common Cartridge XML files into C# classes. XDT files downloaded from the IMS Global Technical Resources page
Installation
Install from the Nuget repository [https://www.nuget.org/packages/AndcultureCode.CommonCartridge.Parser/]
Usage
Parsing a cartridge manifest file
using CommonCartridge.Core;
using CommonCartridge.Core.Constants;
using CommonCartridge.Core.Interfaces;
var fileContent = File.ReadAllText(filename);
var parser = new Parser();
var versionParser = new VersionParser();
// Check Version
var version = versionParser.GetSchemaVersion(fileContent);
if (version == Versions.VERSION_1_0)
{
// v0 variable contains a fully structured class representing the Common Cartridge 1.0 manifest
var v0 = parser.FromCCXml<CommonCartridge.Core.Models.v1_0.ManifestType>(fileContent, directoryPath);
} else if (version == Versions.VERSION_1_1)
{
// v1 variable contains a fully structured class representing the Common Cartridge 1.1 manifest
var v1 = parser.FromCCXml<CommonCartridge.Core.Models.v1_1.ManifestType>(fileContent, DirectoryPath);
} else if (version == Versions.VERSION_1_2)
{
// v2 variable contains a fully structured class representing the Common Cartridge 1.2 manifest
var v2 = parser.FromCCXml<CommonCartridge.Core.Models.v1_2.ManifestType>(fileContent, DirectoryPath);
} else if (version == Versions.VERSION_1_3)
{
// v3 variable contains a fully structured class representing the Common Cartridge 1.3 manifest
var v3 = parser.FromCCXml<CommonCartridge.Core.Models.v1_3.ManifestType>(fileContent, DirectoryPath);
}
Parsing an LTI file
using CommonCartridge.Core;
using CommonCartridge.Core.Constants;
using CommonCartridge.Core.Interfaces;
var fileContent = File.ReadAllText(filename);
var parser = new Parser();
var versionParser = new VersionParser();
// Check Version
var version = versionParser.GetSchemaVersion(fileContent, "blti");
if (version == Versions.VERSION_1_0)
{
// v0 variable contains a fully structured class representing the LTI 1.0 file
var v0 = _parser.FromXml<CommonCartridge.Core.Models.v1_0.CartridgeBasicLTILinkType>(fileContent);
} else if (version == Versions.VERSION_1_1)
{
// v1 variable contains a fully structured class representing the LTI 1.1 file
var v1 = _parser.FromXml<CommonCartridge.Core.Models.v1_1.CartridgeBasicLTILinkType>(fileContent);
} else if (version == Versions.VERSION_1_2)
{
// v1_1 variable contains a fully structured class representing the LTI 1.1.2 file
var v1_1 = _parser.FromXml<CommonCartridge.Core.Models.v1_1_1.CartridgeBasicLTILinkType>(fileContent);
}
Interfaces
IParser
FromLTIFile<T> Same as FromXml, but also loads file from specified path before parsing. Returns ParserResult<T>
FromLTIXml<T> Loads XML into XDocument and deserializes to provided class. Returns ParserResult<T>
FromCCArchive<T> Verifies extension of archive, attemps to unzip into a temp directory, and looks for an imsmanifest.xml file to pass to FromCCFile. Returns ParserResult<T>
FromCCFile<T> Same as FromCCXml, but also loads file from specified path before parsing. Returns ParserResult<T> FromCCXml<T> Loads XML into XDocument and deserializes to provided CC class. Returns ParserResult<T>
IVersionParser
GetSchemaVersionFromFile Same as GetSchemaVersion, but also loads file from specified path before parsing. Returns string
GetSchemaVersion Loads XML into XDocument attempts to read version string from XML schemaversion attribute. Second param (prefix) is optional, will attempt to read the version from a custom namespace. Default empty. Returns string
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
.NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
.NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen40 was computed. tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.0
- Newtonsoft.Json (>= 10.0.3)
- System.Xml.XmlSerializer (>= 4.3.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|
Manual modifications of CC QTI v1.2 to support additional SetVarTypeAction values